Forum Discussion

JérémyRenard's avatar
JérémyRenard
New Contributor III
11 days ago
Solved

How can I retrieve the name of the form template using a finance business rule?

Hello everyone, Thanks to this discussion: https://community.onestreamsoftware.com/discussions/WorkflowDI/forms-by-entity/13417 I can now show or hide the input cube views based on whether or not...
  • MarcusH's avatar
    MarcusH
    7 days ago

    As far as I know the args parameter does not contain the name of the Form that is calling the Business Rule. You have to add a parameter to the Frequency Member Filter like this:

    T#Root.CustomMemberList(BRName=MyBRName, MemberListName=IsFormValidForEntity, FormName=[0001])

    You then process the parameters like this:

    Public Function Main(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs) As Object
    	Try
    		Select Case api.FunctionType
    			Case Is = FinanceFunctionType.MemberList
    				#Region "IsFormValidForEntity"
    				If args.MemberListArgs.MemberListName.XFEqualsIgnoreCase("IsFormValidForEntity") Then
    					'-- Usage: T#Root.CustomMemberList(BRName=myBRName, MemberListName=IsFormValidForEntity, FormName=[0001])
    					Return IsFormValidForEntity(si, globals, api, args)
    				End If   
    				#End Region
    			.....
    		End Select
        Catch ex as exception
    		....	
        End try		
    End Function
    			
    Private Function IsFormValidForEntity(ByVal si As SessionInfo, ByVal globals As BRGlobals, ByVal api As FinanceRulesApi, ByVal args As FinanceRulesArgs) As MemberList
    	Try
    		#Region "Form Parameters"
    		' Get the parameters passed through from the Form Template
    		Dim thisFormName As String = args.MemberListArgs.NameValuePairs.GetValueOrEmpty("FormName")		
    		#End Region
    
    		' Build member list with Time members.
    		
    		Return memberList
        Catch ex as exception
    		....	
    	
    	End try
    End Function