How to add users in group through Scripted Rest API ??

sangitakumari
Tera Contributor
 
8 REPLIES 8

piyushsain
Tera Guru
Tera Guru

You can add them through creating a scripted rest API. You can send the users and group details through JSON and in the script you can retrieve the data and through the script insert the users to the group membership 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

Kalyani Jangam1
Mega Sage
Mega Sage

Hi @sangitakumari 

I have created post rest table api in "sys_user_grmember" and added user in group like below

Go to the Rest=> Rest Api explorer and create new POST table api like below

Screenshot 2023-08-07 at 6.54.12 PM.pngScreenshot 2023-08-07 at 6.54.43 PM.png

This will create record in sys_user_grmember and user will add in group.

Please check and Mark Helpful and Correct if it will help you.

 

Ankur Bawiskar
Tera Patron
Tera Patron

@sangitakumari

what's your business requirement?

You can use OOB table API or scripted rest API.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@Ankur Bawiskar 

when they add members in group from source instance so it will reflect in target instance. that is the requirement.