2 weeks ago
I am trying to retrieve Workflow Channel Information for a specific Workflow Profile in a Business Rule. I am able to fetch it using SQL using the Attribute Index value. Just checking if there is any in-built function to fetch it.
2 weeks ago
BRApi.Workflow.Metadata.GetProfile(si, si.WorkflowClusterPk).Name
2 weeks ago
This will return Workflow Profile Name, I want the Workflow Channel.
2 weeks ago - last edited 2 weeks ago
@vignesh - The below Code Provide you the Value of WF Channel not the name. Hope this is a good starting point for you.
In SQL it is easy.
Sample 1
Dim scenario As String = "Actual"
Dim wfClusterPk2 As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, "CORP GL LOAD", scenario, "2024M1")
Dim objList As List(Of WorkFlowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, wfClusterPk2, WorkflowProfileRelativeTypes.Descendants, WorkflowProfileTypes.InputImportChild)
Dim wfList As New Dictionary(Of String, WorkFlowProfileInfo)
For Each w As WorkflowProfileInfo In objList
Dim A As String = w.GetAttributeValue(ScenarioTypeID.Actual, SharedConstants.WorkflowProfileAttributeIndexes.WorkflowChannel)
brapi.ErrorLog.LogMessage(si,A)
Next
Sample 2
--------------
Dim wfCh As String = brapi.Workflow.Metadata.GetProfile(si,"GL Data load COPR STD.Import").GetAttributeValue(ScenarioTypeID.Actual, SharedConstants.WorkflowProfileAttributeIndexes.WorkflowChannel,Nothing)
brapi.ErrorLog.LogMessage(si,wfCh)
2 weeks ago
The Process Control Manager (PCM) MarketPlace solution has an example and that uses SQL so I'm not sure if there is a built-in function:
Dim accountChannelId As Guid = BRApi.Finance.Account.GetWorkflowChannelID(si,dataCell.DataCell.DataCellPk.AccountId, wfUnitPk.ScenarioKey)
Dim accountChannelName As String = Me.GetWFChannelNameFromId(si, accountChannelId.ToString)
.....
Public Function GetWFChannelNameFromId(ByVal si As SessionInfo, ByVal channelKey As String)
Try
'Return the WF Channel from the provided ID
Dim channelName As String
If channelKey = "44f49acf-571f-4a98-a58d-069671b909e5" Then
channelName = "PCM_Standard"
Else If channelKey = "2bca6f09-00d8-4087-9d66-8c378077de01" Then
channelName = "AllChannelInput"
Else
Dim sql As New Text.StringBuilder
sql.Append("SELECT Name ")
sql.Append("From WorkflowChannel ")
sql.Append("Where UniqueID = '" & channelKey.ToString & "'")
Using dbConnApp As DbConnInfo = BRApi.Database.CreateApplicationDbConnInfo(si)
Using sqlTable As DataTable = BRApi.Database.ExecuteSql(dbConnApp, sql.ToString, False)
If Not sqlTable Is Nothing Then
Dim dr As DataRow = sqlTable.Rows(0)
channelName = "PCM_" & dr(0).ToString
End If
End Using
End Using
End If
Return channelName
Catch ex As Exception
Throw ErrorHandler.LogWrite(si, New XFException(si, ex))
End Try
End Function
The Standard Application Reports (RPTA) solution does it in a different way from a Dashboard Extender:
Dim wfWcfService As New OneStream.Shared.Wcf.Workflow()
Dim wfChannel As WorkflowChannel = wfWcfService.GetWorkflowChannel(si, storedGuidValue)
If (Not wfChannel Is Nothing) Then
Return wfChannel.Name
End If