- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 02:29 AM
How to write a client script to calculate impact and urgency so that priority should auto populate
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2020 03:14 AM
Sample script as below.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var getimpact=g_form.getValue('impact'); //replace impact variable name
alert('Impact user selected is '+getimpact); //Just for check can be commented
var geturgency=g_form.getValue('urgency'); //replace urgency with variable name
alert('Urgency user selected is '+geturgency); //for check can be commented
if(getimpact=='high' && geturgency=='high')
{
g_form.setValue('priority','high'); //replace priority with variable name & set the value as high
}
//Type appropriate comment here, and begin script below
}
Note: You need to create 2 one for impact & other for urgency & replace variables & values accordingly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2020 03:14 AM
Sample script as below.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
var getimpact=g_form.getValue('impact'); //replace impact variable name
alert('Impact user selected is '+getimpact); //Just for check can be commented
var geturgency=g_form.getValue('urgency'); //replace urgency with variable name
alert('Urgency user selected is '+geturgency); //for check can be commented
if(getimpact=='high' && geturgency=='high')
{
g_form.setValue('priority','high'); //replace priority with variable name & set the value as high
}
//Type appropriate comment here, and begin script below
}
Note: You need to create 2 one for impact & other for urgency & replace variables & values accordingly.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-01-2020 10:00 PM
Note: You can have only 1 answer correct so mark the one that helped & should help future readers.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-27-2023 06:40 AM
Sir , what about the impact -1 & urgency 2 for getting priority 2...like that remaining value s as imp-1&urg 2 for pri-3 like that please give answer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-28-2020 03:07 AM
For this you would require onChange client script on both the variables
1) Impact
2) Urgency
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-29-2020 03:37 AM
Hi Ankur, need some information can you message to my my id please. ranjithparam99@gmail.com