- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 03:38 AM
To copy Select Box variable choice values to another table choice field ?
Below did not work for me , I wrote this in Workflow RunScript activity :
var gr = new GlideRecord('incident');
gr.initialize();
gr.assignment_group = current.variables.support_group.getDisplayValue();
gr.insert();
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 03:42 AM
Hello,
remove getdisplayValue() and try below
var gr = new GlideRecord('incident');
gr.initialize();
gr.assignment_group = current.variables.support_group;
gr.insert();
}
Hope this helps
please mark my answer correct if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 03:44 AM
Hi There,
1. You need a sys_id for Assignment group field, so you need to remove getDisplayValue() from your code.
2. What are you getting in current.variables.support_group, it should give you a valid sys_id of a group which can stored in your incident's assignment group.
Try below changes in your script if above things are correct:
var grInc = new GlideRecord('incident');
grInc.initialize();
grInc.assignment_group = current.variables.support_group;
grInc.insert();
Please mark this as correct and helpful if it resolved the query or lead you in right direction.
Thanks,
Mohit Kaushik
Community Rising Star 2022
Mohit Kaushik
ServiceNow MVP (2023-2025)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 04:04 AM
It just an example i gave i should have given for some other field .It is a choice field only both catalog item and incident table.
eg:
gr.status= current.variables.app_status.getDisplayValue();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 03:50 AM
Hi,
You can also use this
var gr = new GlideRecord('incident');
gr.initialize();
gr.setDisplayValue('assignment_group', current.variables.support_group.getDisplayValue());
gr.insert();
//}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 04:16 AM
It is not updating the choice field in incident table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 04:29 AM
For choice values, use something like below.
gr.setValue('state', current.variables.state.toString());