Forum Discussion

jwagner's avatar
jwagner
New Contributor III
9 months ago

How to access Security Group assigned to WF Profile

Is there a way to get a given Workflows JournalProcess, Approval and Submit Security Groups through a Business Rule.  I need to send an email to these users in the security group as these events happ...
  • Krishna's avatar
    9 months ago

    jwagner - The below code is an example to get the journal approval group. you can do the same for other journal groups.

    	Dim wfClusterPk2 As WorkflowUnitClusterPk = BRApi.Workflow.General.GetWorkflowUnitClusterPk(si, "Total_Corporate", "Actual","2024M1")
    	Dim objList As List(Of WorkFlowProfileInfo) = BRApi.Workflow.Metadata.GetRelatives(si, wfClusterPk2, WorkflowProfileRelativeTypes.Descendants,WorkflowProfileTypes.InputAdjChild)
    	Dim wfList As New Dictionary(Of String, WorkFlowProfileInfo)
    		For Each w As WorkflowProfileInfo In objList
    			Dim WFPName As String = w.NameAndDescription
    			If WFPName ="USA_DataLoad.Adj" Then 
    				Dim getunqId As String = w.GetAttributeValue(ScenarioTypeID.Actual, SharedConstants.WorkflowProfileAttributeIndexes.JournalApprovalGroup,Nothing)
    				brapi.ErrorLog.LogMessage(si,getunqId & "----Get UniqueId for Journal Approval Group")
    				Dim objGroupInfoEx As GroupInfoEx = BRApi.Security.Admin.GetGroupInfoEx(si, getunqId.XFConvertToGuid)
    				Dim GroupNameforJournalAppgrp As String = objGroupInfoEx.GroupInfo.Group.Name
    				brapi.ErrorLog.LogMessage(si,GroupNameforJournalAppgrp & "--Get the Journal Approval Group Name")
         		End If 
    		Next