- 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-08-2023 03:54 AM
Hi Tai
no error message is showing
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 09:12 PM
script looks good to me.
ensure you use correct field names etc
what debugging have you done so far?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 03:55 AM
Hi Ankur
yes i am using the correct field names.
pleas advise what debugging i need to do
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-08-2023 04:13 AM
try to add gs.info() and debug
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-07-2023 09:13 PM
Hi @levino ,
As mentioned by aniket there is no field for company in Group table ,hence it is failing. If u intend to populate vendor field in group table then use gr.vendors instead of gr.company.
Attaching the screenshot of available fields in group table.
Thanks,
Danish