Forum Discussion
Locking is a Workflow operation, so you'll have to reason in terms of Workflow - or better, in terms of Workflow Data Unit (also known as Level 2 Data Unit), which is the unique combination of a Workflow, a Scenario member, and a Time member.
' First, define the Primary Key of the Workflow DU you're interested in
' In this example we use what the user has currently selected.
Dim wfCPk As New WorkflowUnitClusterPk( _
si.WorkflowClusterPk.ProfileKey, _
si.WorkflowClusterPk.ScenarioKey, _
si.WorkflowClusterPk.TimeKey)
' Then retrieve the current status
Dim wfInfo As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfCPk, True)
if wfInfo.Locked then
...
end if
If you actually Close workflows (which is not recommended) rather than just locking them, you'll have to check that with GetWorkflowState instead.
Hi JackLacava,
I'm grateful that you respond to all the questions I've posted. In this case, I wanted to see a way to know if the scenario is locked because I have a dashboard that has that parameter and the entity one, but it is in a separate workflow profile. So your solution works for me when I'm in the indicated workflow profile, but not when I'm in an admin one, for example.
As shown in the image, I'm in an admin work profile, and even though the scenario is locked, when I move to other WFProfiles, it's not locked here.
- JackLacava2 years agoHonored Contributor
Just create the WorkflowUnitClusterPk objects passing other parameters, i.e. another profile key, scenario, or time.
- Marco2 years agoContributor II
I'm new to this functions, but is there a way to obtain the WFprofile through the entity? I only have the entity values and the scenario to verify if the scenario is locked or not. Alternatively, is it possible to view it through an SQL table?
- JackLacava2 years agoHonored Contributor
Search in the api helper tree that you get on the left of the editor, there are functions and snippets to retrieve a specific Workflow Profile by name.
For the record, an Entity can be assigned to multiple profiles for different scenarios, so you'll have a hard time going that way. Some people do it by typing the profile name in one of the Text properties of the entity, but then you have to remember to keep things in sync. It makes more sense to reason in terms of Workflow first.
Related Content
- 8 months ago
- 11 months ago
- 2 years ago