Custom calculation rules are powerful tools in data automation. One simple way to make them even more powerful, is to create and capture an audit trail of when these rules have been run by end users. When processes have multiple people executing a Workflow, paths can be crossed and it’s easy to question if your data is most up to date.
With a little code addition to your custom calculation rule, a few supplemental accounts, and a data adapter, you can quickly add a timestamp to a label component, cube view, or report to display who, when, and where the rule was last executed.
First, add supplemental accounts to your metadata to house this timestamp:
Next, update your business rule to pull the system time, workflow information, and any other detail you would like to capture about the runtime of this rule. Set this detail as a data attachment on one of your timestamp accounts created in the previous step.
Private Sub MonthlyCopy(ByVal si as SessionInfo, ByVal api as FinanceRulesApi, ByVal args as FinanceRulesArgs)
Dim curTime as Date = DateTime.Now
Dim wfID as Guid = si.WorkflowClusterPk.ProfileKey
Dim wfName as String = BRApi.Workflow.Metadata.GetProfile(si, wfID).Name
Dim wfTime as String = api.Pov.Time.Name
curTime.ToString & " " & wfName & " - " & wfTime, _
To bring this information into a dashboard for display, set up a data adapter and attach that adapter to a label component. A sample SQL query for this data adapter can be found below:
Once these pieces have been built out, an example use-case is to set a button to run our custom calculate rule and refresh the label component. This label component will then display the text we have written into our timestamp accounts along with the username that created the data attachment.
Note: A non-dashboard solution could be to display this audit information in a Cube View with the timestamp Accounts in the columns, Entities in the rows, and View set to Annotation.
With this simple improvement to your data automation processes, you can empower users with the knowledge and assurance that they have the correct data as they work through and complete their Workflow.