Help with GetUsersInWorkflowGroup function

RyanDiehl
New Contributor II

I'm trying to lookup the users in a workflow execution group so I can e-mail them when the harvest batch process runs successfully. Below is the code I'm using to try and lookup the users within a workflow execution group.

The problem is I don't know what to put in the "WorkflowGroupType" as Integer argument. 

RyanDiehl_1-1681407976018.png

I know that any number between 0 and 1249 will allow the function to run, but putting 1250 will error the function. I created a loop just to see if I could get any of the valid values to return something and didn't have any luck. 

 

RyanDiehl_0-1681407920739.png

Has anyone been able to successfully do this?

Thanks!

1 ACCEPTED SOLUTION

epadua
New Contributor II

workflowGroupType corresponds to the workflow profile attribute index, not too sure why 1250 is erroring out on you, as that's the exact index for the Workflow Execution Group.

Also, probably better to set your text1Filter to `String.Empty` or `""` instead of `Nothing` since the function is expecting to parse a string, not an object.

Maybe try different groups to check.

Also for reference:

Certification Sign Off Group = 16100

Workflow Execution Group = 1250

 

View solution in original post

3 REPLIES 3

epadua
New Contributor II

workflowGroupType corresponds to the workflow profile attribute index, not too sure why 1250 is erroring out on you, as that's the exact index for the Workflow Execution Group.

Also, probably better to set your text1Filter to `String.Empty` or `""` instead of `Nothing` since the function is expecting to parse a string, not an object.

Maybe try different groups to check.

Also for reference:

Certification Sign Off Group = 16100

Workflow Execution Group = 1250

 

RyanDiehl
New Contributor II

Thanks Eric! You are Awesome!

I had found the same 1250 as the number it should be and that's what led me down that path. For those looking for the different "WorkflowGroupType" codes, below is where they are.

RyanDiehl_0-1681482553788.png

 

The change from "Nothing" to "String.Empty" did the trick! 

Also for those interested, here is the code that works:

Dim userList As List(Of UserInfo) = BRApi.Workflow.General.GetUsersInWorkflowGroup(si,wfPK,1250, False,String.Empty)

RyanDiehl_1-1681482672883.png

 

Nikpowar97
New Contributor III

Thanks for the solution above I was looking for the specific Ids here for the workflowGroupType 

Though I was looking for some alternate solution here to see the Session user is part of the WF Execution Group for Table views Security.

BRApi.Security.Admin.GetGroupInfoEx(si,BrApi.Workflow.Metadata.GetProfile(si,si.WorkflowClusterPk.ProfileKey).GetAttributeValue(-1,1250).XFConvertToGuid).GroupInfo.Group.Name)
OR 
BRApi.Workflow.General.GetUserWorkflowInitInfo(si).WorkflowViewItems(0).UserIsWorkflowExecutor

Posting this may be can help someone lookup for the specific use case. 🙂

PS: this is not a solution for the above question but just a similar use case that can help. 🙂