Forum Discussion

xtensibilitybro's avatar
xtensibilitybro
New Contributor III
2 years ago

Confirmation Rule - Yearly Workflow Tracking Frequency

Hi Community,

Does anyone have experience running confirmation rules when the workflow tracking frequency on the scenario is set to yearly? 

The rule looks like its only running for the POV time which the WFYear but I want the rule to run for each period. I'm hoping someone else has come across this as well.

Cheers!

  • EricOsmanski's avatar
    EricOsmanski
    Valued Contributor

    Consider giving this enhancement a thumbs up which addresses your issue.

    https://community.onestreamsoftware.com/t5/Platform/Confirmation-Rules-should-run-on-Input-Frequency-not-WF-Tracking/idi-p/16010

    In order to do this, you will have to loop over each of the time periods and then display the errors in the Information boxes.

    As an example may look like this:

    Dim failedItemList As New Text.StringBuilder()
    Dim isFailedCount As Integer = 0
    args.ConfirmationRuleArgs.Info4 = String.Empty
    args.ConfirmationRuleArgs.Info4 = "Pass"
    Dim assignedEntityName, periodDesc As String
    
    Dim assignedEntities As List(Of WorkflowProfileEntityInfo) = _
    	BRApi.Workflow.Metadata.GetProfileEntities(si, si.WorkflowClusterPk.ProfileKey)
    Dim wfTime As String = BRApi.Workflow.General.GetUserWorkflowInitInfo(si).SelectedWorkflowView.Year
    Dim timePeriods As List(Of MemberInfo) = _
    	BRApi.Finance.Metadata.GetMembersUsingFilter(si, "Time", "T#" & wfTime & ".Base", True)
    
    For Each assignedEntity As WorkflowProfileEntityInfo In assignedEntities
    	For Each period As MemberInfo In timePeriods
    		assignedEntityName = assignedEntity.EntityName
    		periodDesc = period.Member.Description
    
    		Dim cell As Decimal = api.Data.GetDataCell( _
    				"E#" & assignedEntity.EntityName & ":T#" & period.Member.Name & _
    				":C#Local:V#YTD:A#BalSheetAccts:F#Top:O#Top:I#Top" & _
    				":U1#Top:U2#Top:U3#Top:U4#Top:U5#Top:U6#Top:U7#None:U8#None" _
    			).CellAmount
    
    		If cell <= -1.00 Or cell >= 1.00 Then
    			args.ConfirmationRuleArgs.Info4 = "Fail"
    			failedItemList.Append( _
    				"E#" & assignedEntityName & " T#" & periodDesc & " Amount: " _
    				& Math.Round(cell,2).ToString & Chr(13))
    			isFailedCount += 1
    		End If
    	Next
    Next
    
    args.ConfirmationRuleArgs.Info1 = "Failed Items: " & Chr(13) & failedItemList.ToString
    args.ConfirmationRuleArgs.DisplayValue = isFailedCount
    
    'Process the pass/fail flag
    If args.ConfirmationRuleArgs.Info4.Equals( _
    		"Fail", StringComparison.InvariantCultureIgnoreCase) Then
    	Return False
    Else If args.ConfirmationRuleArgs.Info4.Equals( _
    		"Pass", StringComparison.InvariantCultureIgnoreCase) Then
    	Return True
    End If