Security Access Error | Get Parent Workflow Status

ChrisBadenhorst
New Contributor II

Hi,

I've got a business rule where I use BRApi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk) to look at the status of the parent workflow profile. 

However, if a user does not have access to the parent workflow profile, then they get an error "Security Access Error. User is not authorized to access workflow profile". So it seems that the function BRApi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk) is not very useful and it is a bit bizarre that it refers to user security. Is there a way to run this business rule as administrator perhaps or something else I can do?

9 REPLIES 9

MikeG
Contributor III

Hi @ChrisBadenhorst  you can get to the Workflow Status of any WFPOV.  I have not used a BR to do that.  Take a look at this WorkflowStatus Method Query which is available on the platform by way of a Dashboard Data Adapter.  Create a new Data Adapter, for the Command Type select 'Method', for the Method Type select 'WorkflowStatus'.  OneStream provides you a hint of the parameters needed to execute the Method Query.  You can get all of the Statuses for each Workflow Task in a single Cube Root Workflow Profile.

MikeG_0-1687353584507.png

Hope this helps.

 

Thank you Mike,

I unfortunately need to use a BR as there are a few things that need to happen based on the workflow status of the parent profile.

Chris

Hi @ChrisBadenhorst 

Try that ; 

'Check the Workflow status of the parent (We can't calculate plan if the parent is certified)
Dim wfRegParent As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk)
Dim wfRegParentPk As New WorkflowUnitClusterPk(wfRegParent.ProfileKey, si.WorkflowClusterPk.ScenarioKey, si.WorkflowClusterPk.TimeKey)
Dim wfRegParentStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfRegParentPk, False)	



Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

Hi Nic!

Thanks.

It errors on this line if the user does not have access to the Parent Workflow Profile.

 

Dim wfRegParent As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk)

 

Try 

BRApi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk, False)
Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

Hi Nic,

Unfortunately, the GetParent function only accepts two arguments. One being the session info and the other the workflow you are getting the parent for.

ChrisBadenhorst_0-1687358093135.png

 

NicolasArgente
Valued Contributor

Sorry, My bad : Dim wfParentStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfParentPk, False) 

Connect with me on:
LinkedIn: https://www.linkedin.com/in/nicolas-argente/
Website: https://aiqos.io
If you want to lift yourself up, lift up someone else.

Hi Nic,

Yes that is the 3rd line in the code, but it errors at the 1st. Unless there is a different way to get the wfParentPk other than using the GetParent function?

Dim wfRegParent As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetParent(si, si.WorkflowClusterPk)
Dim wfRegParentPk As New WorkflowUnitClusterPk(wfRegParent.ProfileKey, si.WorkflowClusterPk.ScenarioKey, si.WorkflowClusterPk.TimeKey)
Dim wfRegParentStatus As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfRegParentPk, False)	

 

Most of the Brapi command uses security to do stuff (which is the whole point of having security). If the user is not having access to the parent, then I don't think there is a way around it. Other way to do it will be querying the profile table and getting the GUID from there and use it to create your clusterpk.