Skip to main content
Newcomer
April 13, 2023
Solved

Help with GetUsersInWorkflowGroup function

  • April 13, 2023
  • 2 replies
  • 0 views

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!

Best answer by epadua

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

 

2 replies

epaduaAnswer
Newcomer
April 14, 2023

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

 

RyanDiehlAuthor
Newcomer
April 14, 2023

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

 

Contributor
November 10, 2023

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

OneStream Employee
January 7, 2025

Hello,

I have a follow-up on this one : what if the workflow group is "everyone" ? It seems this function can't pick up this specific group (which is there by default): with this group, 0 users are returned. How would you bypass that ?

Regards,

RyanDiehlAuthor
Newcomer
January 7, 2025

So in this case you'd want all users right? Would using the "GetUsers" BRAPI work for you? 

objList = BRApi.Security.Admin.GetUsers(si)

OneStream Employee
January 7, 2025

That's the idea yes, however you also have a "nobody" group which also returns 0 users (obviously 😀 ) ... is there a way to just get the group and not the users within the group ?

Regards,