Forum Discussion

NicoleBruno's avatar
NicoleBruno
Valued Contributor
3 months ago
Solved

Want to report on Workflow Profile Workflow Name (a property on the WF profile step setup)

I'm looking for a way to report on our workflow profile set up - specifically want to be able to pull the workflow profile (the forms step added to the WF) and the associated "Workflow Name" (which i...
  • sameburn's avatar
    3 months ago

    Hi NicoleBruno​

    This is how to retrieve Workflow Name property..

    ' Derive WorkflowInfo
    Dim wfinfo As WorkflowInfo = BRApi.Workflow.Status.GetWorkflowStatus(si, si.WorkflowClusterPk, True)
    ' Get WorkflowName e.g. Import, Validate, Load
    Dim wfName As String = wfinfo.Name

    You can also retrieve a Dictionary of Workflow attributes by index from WorkflowProfileInfo object

    ' Create stringbuilder			
    Dim sb As New Text.StringBuilder
    
    ' Declare WorkflowProfileInfo
    Dim wfInfo As WorkflowProfileInfo = BRApi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk)
    
    ' Get Dictionary of WorkflowProfileAttributeIndexes (for default scenario type)
    Dim objDict As Dictionary(Of Integer, String) = SharedConstants.WorkflowProfileAttributeIndexes.GetAttributes(wfInfo.Type)	
    sb.AppendLine(String.Join(Environment.NewLine, objDict.Select(Function(kvp) String.Format("Key ➡ {0}, Value ➡ {1}, AttributeValue ➡ {2}", kvp.Key, kvp.Value, wfInfo.GetAttributeValueForDefaultScenarioType(kvp.Key)))))				
    
    ' Log Result ➡ Throw Error				
    Throw New XFException(sb.ToString())		

    Hope this helps

    Sam