- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 07:01 PM
When a catalog form is submitted, how can i create group with the name mentioned in "group name" field.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 07:16 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 07:16 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 07:36 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-27-2022 07:55 PM
Hi,
This script you have to use in workflow run script activity. Or in flow have to try this.
Sagar Pagar

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2022 12:43 AM
Hi SNOW,
It's not possible to create create a group onSubmit because record must be created on the server-side and onSubmit shouldn't asynchronously call server-side script.
The way to create group is to create a Service Catalog item and Flow Designer flow to create a group.
1. Service Catalog
- Create a Service Catalog item with variable "Group name" of type "Single Line Text".
2. Create a Flow Designer flow
- From Application Navigator, select "Process Automation" > "Flow Designer"
- Select "New" - "Flow"
- Enter the name of the Flow and click on the "Submit" button.
- Click on "Add a trigger" and select "Service Catalog"
- Click on "Add action" and select "Get Catalog Variables".
- Drag and drop "Requested Item Record" to "Submitted Request" field and select the name of Service Catalog that was created above. Catalo Variable should display "group_name". Move it from "Available" to "Selected"
- Select "Add an action" again and select "Create Record".
- Select "Group [sys_user_group]" as table and select "Name" as field. Drag and drop "group_name" under "1 - Get Catalog Variable" as the value of the field.
- Click on "Save" button and then on "Activate" button.
3. Set Flow to execute when Service Catalog is submitted.
- Re-open Service Catalog that was created.
- Select "Process Engine" tab and select Flow that was create above. Save the Service Catalog.
Execution sample
step 1: enter a group name and submit the form.
step 2: Open "Groups" to check that the group is create.