- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 08:42 PM
Hi Team
in run script activity which is a part of a workflow, the below does not seem to work, am i missing something?
Thanks
Levino
workflow.scratchpad.Description = current.variables.description;
workflow.scratchpad.NewGroupName = current.variables.new_group_name;
var gr = new GlideRecord('sys_user_group'); //To create group
gr.initialize();
gr.name = workflow.scratchpad.NewGroupName;
gr.type = 'a23a29e8dbec8850304c147a3a96191f';
gr.description = workflow.scratchpad.Description;
gr.setWorkflow(false);
gr.autoSysFields(false);
gr.sys_updated_by = 'admin_sp';
gr.sys_created_by = 'admin_sp';
gr.company = 'd9057fc1db98d7005070326f7c961926';
var grSysid = gr.insert();
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 08:55 PM
There is no field called "Company" in the sys_user_group table. Please check if you really have this one. Try commenting out this line
gr.company = 'd9057fc1db98d7005070326f7c961926';
and then check if your script is working.
Let me know if this works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 08:55 PM
There is no field called "Company" in the sys_user_group table. Please check if you really have this one. Try commenting out this line
gr.company = 'd9057fc1db98d7005070326f7c961926';
and then check if your script is working.
Let me know if this works
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 03:53 AM
Hi Aniket
i have commented the line , still does not create the group
Thanks
Levino
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 03:58 AM
Try this code and check initially if the group itself is getting created or not:
workflow.scratchpad.Description = current.variables.description;
workflow.scratchpad.NewGroupName = current.variables.new_group_name;
gs.info("workflow_runscript: "+workflow.scratchpad.NewGroupName);
var gr = new GlideRecord('sys_user_group'); //To create group
gr.initialize();
gr.name = workflow.scratchpad.NewGroupName;
var grSysid = gr.insert();
gs.info("workflow_runscript group_sysid: "+grSysid);
This is expected to work. If this works, try adding one one field to your Group table and debug it that way.
Let me know if this helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 09:04 PM