Clarke_Hair
6 months agoContributor
Fcst - Copy of Actuals into Locked/Certified Fcst scenario via BR
We have a job that leverages the Global Time and Scenario to copy Actuals over into our Fcst Scenario. My question is around the ability of a BR to change data in a certified scenario. From what we...
- 6 months ago
There is not a way (that I know of) to stop BRs from running on locked or certified workflows. The below script will check workflow status and throw an error if the workflow is completed or locked.
Dim wfInfoAlloc As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, si.WorkflowClusterPk) If wfInfoAlloc.AllTasksCompleted = True Then Throw (New XFUserMsgException(api.si, Nothing, Nothing, " >>> Rule cannot be executed because workflow is COMPLETED... revert workflow in order to execute")) Else If wfInfoAlloc.Locked = True Then Throw (New XFUserMsgException(api.si, Nothing, Nothing, " >>> Rule cannot be executed because workflow is LOCKED!")) End If
Note that there is a performance impact of using the BRApi.Workflow.Status.GetWorkflowStatus call because it has to open up a database connection to the Workflow Engine. So if this rule is being kicked off by many users at the same time, you could experience some significant server strain as many database connections are opened for each instance of the rule being ran.