We are under construction!
You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.
You may experience downtime, errors or visual oddities, but we anticipate all will be resolved by the end of the day.
Hello Everyone,
I’m not sure if I’m not understanding or just approaching the code wrong. We’ve been on OneStream for about two years and myself and my co-admin are not extensive in our code knowledge. We can generally copy/tweak what the implementation partners build, or searching the forums here, but I’d put us as basic or being generous intermediate level.
We have a workflow that loads to the actual scenario and has some workflow steps at the end that are for a variance scenario where the users enter commentary balances.
The Variance scenario steps auto lock when certified and I want a business rule to unlock the variance steps if the Actual Import_Ledger step is re-run.
I have code in the TransformationEventHandler rule that accomplishes this for me, but when users are running the import it gives the error of user has not been granted access to application role “UnlockWorkflowUnit”
I thought (possibly erroneously) that by using a business rule the system would allow unlocking to trigger but this security issue is preventing that. Can this be accomplished? Is there better code than mine below to not use the user’s security or have this event happen as a system ID or such? We do not want to give these end users the ability to unlockworkflows as that is restricted to the CORP/Admin team.
Thanks in advance for any suggestions or thoughts.
Dan Welcheck Jr
'DRW added below as part of URP implementation to "reset" URP workflows if import ledger is re-run
Dim urpScenario As String = "URP_Review"
'get parent workflow status from URP Scenario
Dim wfClusterPk_Top As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, wfNode, urpScenario, wfTime)
Dim wfStatus_Top As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk_Top, False)
'Check if the form input WF is completed
If wfStatus_Top.Locked Then 'IF parent is locked, don't do anything (these should be off period workflows that are locked because not required)
'Do nothing
Else
'Unlock/reject URP_Prepare
'Check if WF is locked and if so unlock
Dim sURPprepWFPName As String = wfNode & "." & "URP_Prepare"
Dim wfClusterPk_URPP As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, sURPprepWFPName, urpScenario, wfTime)
BRApi.Workflow.Locking.UnlockWorkflowUnit(si, wfClusterPk_URPP)
Dim wfInfoU1 As WorkflowInfo = BRApi.Workflow.Status.SetWorkflowStatus(si, wfClusterPk_URPP, stepClassificationTypes.InputForms, status, statusMessage,errormessage,updateReason, knowntaskactivityID)
'Unlock/reject URP_Approve
'Check if WF is locked and if so unlock
Dim sURPappWFPName As String = wfNode & "." & "URP_Approve"
Dim wfClusterPk_URPA As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, sURPappWFPName, urpScenario, wfTime)
BRApi.Workflow.Locking.UnlockWorkflowUnit(si, wfClusterPk_URPA)
Dim wfInfoU2 As WorkflowInfo = BRApi.Workflow.Status.SetWorkflowStatus(si, wfClusterPk_URPA, stepclassification, status, statusMessage,errormessage,updateReason, knowntaskactivityID)
'Unlock/reject URP_Review
'Check if WF is locked and if so unlock
Dim sURPrevWFPName As String = wfNode & "." & "URP_Review"
Dim wfClusterPk_URPR As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, sURPrevWFPName, urpScenario, wfTime)
BRApi.Workflow.Locking.UnlockWorkflowUnit(si, wfClusterPk_URPR)
Dim wfInfoU3 As WorkflowInfo = BRApi.Workflow.Status.SetWorkflowStatus(si, wfClusterPk_URPR, stepclassification, status, statusMessage,errormessage,updateReason, knowntaskactivityID)
End If
End If 'If wfName = "Import_Ledger" Then
Business rules launched by a given user will only have the rights that the user has.
That unlocking activity will have to be run by someone with the right privileges, but you can try to be clever by signaling when it's the right time. For example, you could have the activity run by the basic user set a value or file somewhere, signaling "it's time to unlock please". Then you can have a scheduled DM job, set up by the privileged user, that runs very often; on execution, it will check for that value, and if it finds the value set it performs the unlock and resets the value.
Business rules launched by a given user will only have the rights that the user has.
That unlocking activity will have to be run by someone with the right privileges, but you can try to be clever by signaling when it's the right time. For example, you could have the activity run by the basic user set a value or file somewhere, signaling "it's time to unlock please". Then you can have a scheduled DM job, set up by the privileged user, that runs very often; on execution, it will check for that value, and if it finds the value set it performs the unlock and resets the value.
Thank You Jack,
I think that makes sense now.
Regards,
Dan Welcheck Jr