Forum Discussion

RyanDiehl's avatar
RyanDiehl
New Contributor III
2 years ago

Help with GetUsersInWorkflowGroup function

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. 

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. 

 

Has anyone been able to successfully do this?

Thanks!

  • 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

     

  • epadua's avatar
    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's avatar
      RyanDiehl
      New Contributor III

      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.

       

      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)

       

      • Nikpowar97's avatar
        Nikpowar97
        Contributor

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