- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 06:23 AM
I got a script that is setting the 'assignet_to' to null when the assignment group changes. I want the same script to set the state to a value 1 (Unassigned).
It sort of does it, but initially displays 1, instead of Unassigned. How do I get it to display the label rather than the value just after the 'assignment_group' value changes?
The script I have is:
function onChange(control, oldValue, newValue) {
if (oldValue == newValue) {
return;
}
else {
g_form.setValue('assigned_to', '');
g_form.setValue('state', '1');
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 07:19 AM
See this doc: https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/app-store/good_practices/client_script/concept/c_UseDisplayValParam.html
The second example in this page shows how to set the display value in the assignment statement.
An example could be: g_form.setValue('state', 1, "Unassigned");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 06:28 AM
try using g_form.setValue('state', 1); instead of g_form.setValue('state', '1');
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 07:14 AM
still, I am getting the same result
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 07:16 AM
Then it is just the load time of the form, there is nothing much you can change in this script but check if there is anything else that is taking more time and hence resulting in longer form load time.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-11-2019 07:19 AM
See this doc: https://docs.servicenow.com/bundle/geneva-servicenow-platform/page/app-store/good_practices/client_script/concept/c_UseDisplayValParam.html
The second example in this page shows how to set the display value in the assignment statement.
An example could be: g_form.setValue('state', 1, "Unassigned");