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.

UI action to add user to the group

GB14
Kilo Patron

I tried creating a UI action to add the user to the group but the button won't do anything on click. 

I created the UI action on the sys_user table and added the below script but nothing is happening. Nothing in the logs either. Any suggestions?

 

 

 

var rec = new GlideRecord('sys_user_grmember');
rec.initialize();
rec.user = current.user.sys_id;
rec.group = '9da403d8979fdd103749312e2153af7e'; //group ABC
rec.insert();

 

 

 

1 ACCEPTED SOLUTION

Hi @GB14 

 

can you please uncheck client checkbox and try that will work.

 

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

Regards,

Ranjit Nimbalkar

 

View solution in original post

7 REPLIES 7

Ranjit Nimbalka
Mega Sage

@GB14 

var rec = new GlideRecord('sys_user_grmember');
rec.initialize();
rec.user = current.sys_id;
rec.group = '9da403d8979fdd103749312e2153af7e'; //group ABC
rec.insert();

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

 

Regards,

Ranjit Nimbalkar

Thanks Ranjit 

I tried it but had no success. This is my UI action. 

GB14_0-1683731581127.png

 



Hi @GB14 

 

can you please uncheck client checkbox and try that will work.

 

 

If my answer solved your issue, please mark my answer as  Correct & 👍Helpful based on the Impact.

Regards,

Ranjit Nimbalkar

 

this worked. thank you so much