Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Check if requested by has an admin role or manager for the group

Sathiskumar_D
Giga Sage

Hello,

 

I knew there is OOB Add/remove users from group. I am trying to create my own for the customer's requirement. So I am checking for the "requested By" user's role. if the role has admin or group manager, it doesn't require approval. I am trying to create via subflow because I have to reuse it for removing the users from the group as well. Any help would be greatly appreciated. I have attached screenshot for subflow.

1 ACCEPTED SOLUTION

jonsan09
Giga Sage
Giga Sage

You'll want to setup a user and role input for your subflow. Then query the 'sys_user_has_role' table for the user/role. Based on if the record is found set the output variable to either true or false. I've attached screenshots and XML of the subflow I threw together in my PDI.

2023-09-14 08_04_39-Flow Designer - Flow Designer _ Check User Role — Mozilla Firefox.png2023-09-14 08_04_31-Flow Designer - Flow Designer _ Check User Role — Mozilla Firefox.png2023-09-14 08_04_18-Flow Designer - Flow Designer _ Check User Role — Mozilla Firefox.png

View solution in original post

1 REPLY 1

jonsan09
Giga Sage
Giga Sage

You'll want to setup a user and role input for your subflow. Then query the 'sys_user_has_role' table for the user/role. Based on if the record is found set the output variable to either true or false. I've attached screenshots and XML of the subflow I threw together in my PDI.

2023-09-14 08_04_39-Flow Designer - Flow Designer _ Check User Role — Mozilla Firefox.png2023-09-14 08_04_31-Flow Designer - Flow Designer _ Check User Role — Mozilla Firefox.png2023-09-14 08_04_18-Flow Designer - Flow Designer _ Check User Role — Mozilla Firefox.png