Forms by Entity

Arjen
New Contributor II

In the monthly close process, we have a number of forms. All workflows have the same Form templates profile. Cubeviews refer to |WFtext1|. On wftext1 is Entity name (one entity per workflow).

I have one form that is only applicable to a selection of entities.

Is it possible (and how) to parameterise this, so the form will only be visible in a selection of workflows (I do not want to create  different Forms Template Profile for theses workflows)?

1 ACCEPTED SOLUTION

ChrisLoran
Valued Contributor

Stepping away from the use of dashboards for a moment, and looking back at Form Templates, it's not "officially" possible to make a Form Template conditionally show/hide from the Form Group.

However you can use a dirty trick by using the Form Frequency Member Filter.
You could have a Custom Member List, which if you want to show this Form Template then it returns all the months in the current WF Year.  And if the Form Template should not be shown, then the Member List returns an empty list.

So you're switching on/off the Forms Template by interfering with the Frequency Filter by pointing it to a custom member list.
Let's say I wanted this Forms Template to be conditionally shown, depending on the WF entity assignments.
Then I can use the Frequency Member Filter and put in a custom member list on the Time dimension, even though the decision to show it is based on entity. 

ChrisLoran_0-1668519865106.png

Then in the Custom Member List rule , it will either return a list of time periods in the current year (which makes the Form template visible), or it returns an empty list of time members (which makes the form template invisible).

The BR can then check the current WF profile against the assigned entities, and decide whether the specified CubeView should be shown or hidden, and return either an empty or complete Time filter accordingly.

Here's an example BR which switches the Form Template on/off depending on the WF Profile Entity assignment. In this simple case I just test if any of the assigned entities begin with the word 'Houston' , just for simplicity:

If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("IsFormValidForEntity") Then
	'-- Usage: T#Root.CustomMemberList(BRName=CustomLists, MemberListName=IsFormValidForEntity, CVName=[MNG_Accts])
	
	Dim wpi As WorkflowProfileInfo = brapi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk.ProfileKey)
	Dim st As ScenarioType = api.Scenario.GetScenarioType(si.WorkflowClusterPk.ScenarioKey)
	api.LogMessage("CVName:" & args.MemberListArgs.NameValuePairs.GetValueOrEmpty("CVName") )
	
	' -- Get the current workflow's Text1 property, for the current WF scenario --
	Dim strWFText1 As String = wpi.GetAttributeValue(st.id, _
			SharedConstants.WorkflowProfileAttributeIndexes.Text1, String.Empty)
	api.LogMessage("Workflow Text1 property:" & strWFText1)

	' -- get list of Entities assigned to the parent workflow profile --
	Dim lstProfileEntities As List(Of WorkflowProfileEntityInfo) = brapi.Workflow.Metadata.GetProfileEntities(si, _
			brapi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk.ProfileKey).ProfileKey )
	For Each eInfo As WorkflowProfileEntityInfo In lstProfileEntities
		api.LogMessage("Workflow Entity:" & eInfo.EntityName)
	Next

	Dim objMemberListHeader = New MemberListHeader(args.MemberListArgs.MemberListName)
	Dim timeMbrs As List(Of Member)
	If strWFText1.StartsWith("Houston", StringComparison.InvariantCultureIgnoreCase) Then
		timeMbrs = api.Members.GetBaseMembers( _
			api.Dimensions.GetDim("Time").DimPk, _
			TimeDimHelper.GetYearIdFromId(si.WorkflowClusterPk.TimeKey))
	Else
		'otherwise return empty list of time members , which prevents the form template from showing
		timeMbrs = New List(Of Member) 
	End If
	Return New MemberList(objMemberListHeader, timeMbrs)

End If


Disclosure: this is a bit of a dirty trick, using a custom Time filter to switch on/off a Form Template. That means that if you go back to a fixed Time Frequency on the Form Template (e.g. Monthly, or All Periods), then your historic time periods will show forms profiles that have been completed , but with on Form Template in there shown but not in the complete state (because it was hidden at the time). So your workflow profile history will show an unstable state if you change it back in the future.



 

View solution in original post

4 REPLIES 4

ChrisLoran
Valued Contributor

Hello Arjen
It sounds like you want to dynamically show/hide a cube view Form Template for selection, depending on what entity/entities are bound to the current workflow profile.

Obviously you could have separate workflow Forms profiles , bound to different Form Template groups, but as you said already in the opening post, that would be quite a lot of duplicate maintenance.

What I usually do is put most of the CubeViews into a generic dashboard, which shows a list of cube view items in a list on the left side of the screen, and this cube-view list is dynamically generated from a Data Adapter which uses whatever logic you like to get a list of relevant cube views for the current workflow profile.
Then when you click on the cube view from the list, it refreshes the right-hand CubeView container, which has a parameterised reference to the selected cube view. That gives you a dynamically driven list of cube views to select from, and from a user perspective it can look very similar to the form templates. The only drawback is that it wouldn't have any native form-completion/ form reverting actions. The "complete step" actions would be at the form profile level, not at indivudual cube-view level, but this may be sufficient for many purposes.

 

In terms of getting relevant entities for a workflow profile, I would use a BR like this, instead of duplicating entity assignments in a Text1 property
Dim lstProfileEntities As List(Of WorkflowProfileEntityInfo) = brapi.Workflow.Metadata.GetProfileEntities(si, brapi.Workflow.Metadata.GetParent(si,si.WorkflowClusterPk.ProfileKey).ProfileKey)
For Each eInfo As WorkflowProfileEntityInfo In lstProfileEntities
   Dim strEntityName as String = eInfo.EntityName
  ' -- do something with strEntityName ... etc...
Next

MikeG
Contributor III

Hi Arjen, I'm using this parameter in a Form.  In this example I'm using UD1 but you get the idea, you could point this parameter to Entity and use the WFText property in the Member Filter.

MikeG_0-1668517594981.png

 

MikeG
Contributor III

Your member filter would be E#|WFText1|, and of course the Dimension Type would be Entity and not UD1.

ChrisLoran
Valued Contributor

Stepping away from the use of dashboards for a moment, and looking back at Form Templates, it's not "officially" possible to make a Form Template conditionally show/hide from the Form Group.

However you can use a dirty trick by using the Form Frequency Member Filter.
You could have a Custom Member List, which if you want to show this Form Template then it returns all the months in the current WF Year.  And if the Form Template should not be shown, then the Member List returns an empty list.

So you're switching on/off the Forms Template by interfering with the Frequency Filter by pointing it to a custom member list.
Let's say I wanted this Forms Template to be conditionally shown, depending on the WF entity assignments.
Then I can use the Frequency Member Filter and put in a custom member list on the Time dimension, even though the decision to show it is based on entity. 

ChrisLoran_0-1668519865106.png

Then in the Custom Member List rule , it will either return a list of time periods in the current year (which makes the Form template visible), or it returns an empty list of time members (which makes the form template invisible).

The BR can then check the current WF profile against the assigned entities, and decide whether the specified CubeView should be shown or hidden, and return either an empty or complete Time filter accordingly.

Here's an example BR which switches the Form Template on/off depending on the WF Profile Entity assignment. In this simple case I just test if any of the assigned entities begin with the word 'Houston' , just for simplicity:

If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("IsFormValidForEntity") Then
	'-- Usage: T#Root.CustomMemberList(BRName=CustomLists, MemberListName=IsFormValidForEntity, CVName=[MNG_Accts])
	
	Dim wpi As WorkflowProfileInfo = brapi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk.ProfileKey)
	Dim st As ScenarioType = api.Scenario.GetScenarioType(si.WorkflowClusterPk.ScenarioKey)
	api.LogMessage("CVName:" & args.MemberListArgs.NameValuePairs.GetValueOrEmpty("CVName") )
	
	' -- Get the current workflow's Text1 property, for the current WF scenario --
	Dim strWFText1 As String = wpi.GetAttributeValue(st.id, _
			SharedConstants.WorkflowProfileAttributeIndexes.Text1, String.Empty)
	api.LogMessage("Workflow Text1 property:" & strWFText1)

	' -- get list of Entities assigned to the parent workflow profile --
	Dim lstProfileEntities As List(Of WorkflowProfileEntityInfo) = brapi.Workflow.Metadata.GetProfileEntities(si, _
			brapi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk.ProfileKey).ProfileKey )
	For Each eInfo As WorkflowProfileEntityInfo In lstProfileEntities
		api.LogMessage("Workflow Entity:" & eInfo.EntityName)
	Next

	Dim objMemberListHeader = New MemberListHeader(args.MemberListArgs.MemberListName)
	Dim timeMbrs As List(Of Member)
	If strWFText1.StartsWith("Houston", StringComparison.InvariantCultureIgnoreCase) Then
		timeMbrs = api.Members.GetBaseMembers( _
			api.Dimensions.GetDim("Time").DimPk, _
			TimeDimHelper.GetYearIdFromId(si.WorkflowClusterPk.TimeKey))
	Else
		'otherwise return empty list of time members , which prevents the form template from showing
		timeMbrs = New List(Of Member) 
	End If
	Return New MemberList(objMemberListHeader, timeMbrs)

End If


Disclosure: this is a bit of a dirty trick, using a custom Time filter to switch on/off a Form Template. That means that if you go back to a fixed Time Frequency on the Form Template (e.g. Monthly, or All Periods), then your historic time periods will show forms profiles that have been completed , but with on Form Template in there shown but not in the complete state (because it was hidden at the time). So your workflow profile history will show an unstable state if you change it back in the future.