How to access Security Group assigned to WF Profile

jwagner
New Contributor II

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 happen.  

jwagner_0-1713815024976.png

 

 

1 ACCEPTED SOLUTION

Krishna
Valued Contributor

@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

 

Thanks
Krishna

View solution in original post

2 REPLIES 2

Krishna
Valued Contributor

@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

 

Thanks
Krishna

jwagner
New Contributor II
Dim wfGroupType = 6100 'Process wfGroupType
Dim wfGroupUsers = BRAPI.Workflow.General.GetUsersInWorkflowGroup(si, si.WorkflowClusterPk, wfGroupType, True, String.Empty)