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.

How to create group via script

SNOW39
Tera Expert

When a catalog form is submitted, how can i create group with the name mentioned in "group name" field.

1 ACCEPTED SOLUTION

Sagar Pagar
Tera Patron

Hi,

Try this script and modify it with your variables or fields.

 

var mygr = new GlideRecord("sys_usr_group");

mygr.initialise();

mygr.name = current.variables.groupName;

mygr.manager = "sysid";. // Manager sysid or current.variables.manager field

mygr.type = "type"; // add type here or sysid

mygr.insert();

 

Thanks,

Sagar Pagar

The world works with ServiceNow

View solution in original post

5 REPLIES 5

We already have a workflow associated.