01-10-2022 02:43 PM - last edited on 05-10-2023 05:08 AM by JackLacava
Does any one know if there is a BR command that can get the Workflow Name value from the Workflow Settings area of the Profile Properties (e.g. Import, Validate, Process) in a business rule?
To be clear, I'm not looking for the name of the workflow from the General section. I'm looking for the part of the workflow that determines the chevrons/bubbles that walk the user through the workflow steps
Thanks,
G
Solved! Go to Solution.
01-10-2022 09:19 PM - edited 01-10-2022 09:32 PM
Hi Gidon,
I'm not aware of a supported or clean way to convert a workflow name key to a meaningful name. Perhaps someone else here may know a way?
How is the workflow to check being determined in your rule? If the workflow to check the property for is the user's POV workflow profile, you can use the following approach to retrieve the user's WorkflowInitInfo object and from there, you can retrieve a legible workflow name.
'get the user's POV WF profile info
Dim wfInfo As WorkflowInitInfo = BRApi.Workflow.General.GetUserWorkflowInitInfo(si)
'retrieve the WF name property from the WF
Dim wfName As String = wfInfo.GetSelectedWorkflowUnitInfo().WorkflowName
Regards,
Nick Kroppe
01-10-2022 05:11 PM
Hi Gidon,
The GetAttributeValue workflow profile info property will enable you to retrieve the workflow key value equivalent to the property you are attempting to query. You then may be able to make use of this key by leveraging the shared constants workflow enumeration helper. Hoping this snippet helps.
'retrieve the WF Info for houston.import
Dim wfProfileInfo As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, "Houston.Import")
'retrieve the wf name key as a string for the default scenario type
Dim wfNameKey As String = wfProfileInfo.GetAttributeValueForDefaultScenarioType(sharedConstants.WorkflowProfileAttributeIndexes.Workflow, String.Empty)
'check to see if houston.import has a workflow name of Import-Validate-Load aka a Simple Data Load
If wfNameKey.XFEqualsIgnoreCase(SharedConstants.WorkflowKeys.Workflows.SimpleDataLoad) Then
'do something
End If
Regards,
Nick Kroppe
01-10-2022 05:53 PM
Thanks Nick,
Is there a way to lookup what wfNameKey equates to in English? In other words, I want to return the name, not check to if it is "Import, Validate, Load".
01-10-2022 09:19 PM - edited 01-10-2022 09:32 PM
Hi Gidon,
I'm not aware of a supported or clean way to convert a workflow name key to a meaningful name. Perhaps someone else here may know a way?
How is the workflow to check being determined in your rule? If the workflow to check the property for is the user's POV workflow profile, you can use the following approach to retrieve the user's WorkflowInitInfo object and from there, you can retrieve a legible workflow name.
'get the user's POV WF profile info
Dim wfInfo As WorkflowInitInfo = BRApi.Workflow.General.GetUserWorkflowInitInfo(si)
'retrieve the WF name property from the WF
Dim wfName As String = wfInfo.GetSelectedWorkflowUnitInfo().WorkflowName
Regards,
Nick Kroppe
01-10-2022 09:37 PM
Thanks Nick! This solution works perfectly.
05-27-2022 06:07 PM
Is there a way to retrieve the status of each of the steps in a workflow (Import, Validate, Load):
Step: Status
Import Success
Validate Success
Load Success
05-27-2022 10:06 PM
Hi Oscar,
Check out the Trapping-WF-Import-Validate-Load-Errors thread. It has some code examples of how to get the status of each step.
06-01-2022 01:09 PM
Thanks for the reference. In the examples the status is captured and presented at the time of running the command (ExecuteParseAndTransform) for example. What I am trying to do is retrieve the status in a different BR or step in a DM. The way I ended up accomplishing this was to save the needed run information into a txt file and retrieving the file at the end of the run and submitting in an email
06-22-2023 01:54 PM
Hi. Realise this is an old post but I stumbled across it in my search for the same answer.
In my use case I wanted to pass in the profilekey myself rather than deriving from si (so GetUserWorkflowInitInfo unfortunately not an option). However, we can achieve this via the GetWorkflowStatus BRApi (see snippet).
' Declare WF Variables
Dim wfProfile As String = "Houston.Import"
Dim wfScenario As String = "Actual"
Dim wfTime As String = "2023M1"
' Derive WorkflowUnitClusterPk
Dim wfClusterPK As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, wfProfile, wfScenario, wfTime)
' Derive WorkflowInfo
Dim wfinfo As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, wfClusterPk, True)
' Get WorkflowName e.g. Import, Validate, Load
Dim wfName As String = wfinfo.Name
' Log Result -> Throw Error
Throw New XFException(StringHelper.RemoveWhiteSpace(wfName))
This will return Import, Validate, Load, etc (depending on setup) as the returned objects property name
Cheers
Sam
06-22-2023 02:48 PM
The only issue there is with the hardcoded values. I'm not sure whether it was you on the other thread where I commented to use the ProfileTable (use that if and only if there is an access issue that is preventing you from getting the parent member) to get the name/guid of the workflow and use that to create your pk.