Automate HR group member maintenance

Kohei Tominaga1
Kilo Sage

 

Hi Community,

 

I'm automating HR group membership:

  1. User requests group access via catalog item.
  2. Group manager approves (configured with Service Activity and working fine).
  3. Flow adds user to group (not working).

The flow fails when creating a record in sys_user_grmember. I suspect permissions.

  • Problem 1: "Run as System User" fails.
  • Problem 2: "Run with role" - "HR Admin" role is missing from the role selection list (HR Basic/Manager are visible).

I've opened a support ticket for these issues.

Question: Any alternative flow designs or solutions (business rule, etc.) for automating sys_user_grmember creation? Why might "System User" fail and "HR Admin" be invisible?

Thanks!




3 REPLIES 3

Not applicable

Jaspal Singh
Mega Patron

@Kohei Tominaga1 Did you manage to find any solution?

SupriyaWaghmode
Mega Sage

Hello @Kohei Tominaga1  , 

 

You can create Custom Script action in Flow Designer

Instead of using the native "Create Record" flow step, add a Custom Script Action inside your Flow. Use standard JavaScript to insert the record:
Pass two variable details 

1.User Sys ID 

2. Group Sys ID 

Javascript 

var gr = new GlideRecord('sys_user_grmember');

gr.initialize();

gr.user = inputs.user_sys_id; // add your user input variable 

gr.group = inputs.group_sys_id; //  add your group input variable 

gr.insert();

 

Note: Ensure your HR Scope has Can Create permissions allowed for the sys_user_grmember table in your Application Access settings.


 

If my response helped you, please click on accepted the solution and consider giving it a thumbs-up👍. This helps others find the solution faster and keeps the community thriving. Thank you for your support!😊

Thanks & Regards ,
Supriya Waghmode |ServiceNow Community Rising Star 2025
www.linkedin.com/in/supriya-waghmode