- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 06:18 AM
Hello ,
can anyone help me- my requirement is when we change urgency and impact it will change priority so I want to append new priority change value every time with existing value of short description
for ex-
Priority- 1-critical
Short Description= Printer is not working
Expected Output is-
Short Description= 1-critical Printer is not working
when again changed priority from 1-critical to 2-High then it need to be
Short Description= 2-High 1-critical Printer is not working
can any one tell how to achieve it.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 06:55 AM
@rmaroti You need to create onChange client script on "Priority" field as below
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue && g_form.getValue('short_description')) {
var priority = g_form.getValue('priority');
var priorityDisplayValue = g_form.getOption('priority', priority).text;
var short_desc = priorityDisplayValue + ' ' +g_form.getValue('short_description');
g_form.setValue('short_description', short_desc);
}
}
I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 06:55 AM
@rmaroti You need to create onChange client script on "Priority" field as below
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
if (newValue && g_form.getValue('short_description')) {
var priority = g_form.getValue('priority');
var priorityDisplayValue = g_form.getOption('priority', priority).text;
var short_desc = priorityDisplayValue + ' ' +g_form.getValue('short_description');
g_form.setValue('short_description', short_desc);
}
}
I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 07:07 AM
you can use before update BR
Condition: Priority Changes
Script:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
current.short_description = current.priority.getDisplayValue() + ' - ' + previous.short_description;
})(current, previous);
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2024 07:08 AM
Hi @rmaroti,
Can I ask why you/the business need to display and prepend the priority to the Short Description?
May I suggest you ensure the 'Activities filter' is configured to display the Priority (and Urgency and Impact) field(s). Out of box, whenever the fields in the Activities filter are updated, the activity field will display the old value and the new value.
To help others (or for one-to-one direct help), please mark this response as correct and helpful.
Thanks,
Robbie