- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 04:44 AM
When the user is changing the priority of the incident the priority should be appended at the start of the description with the previous description value? Ex: The previous description is: "The Priority Value is: 5 " then the user changed the urgency to anything and then save the form. after saving it the description should be "The Priority Value is 3";
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 01:05 AM
Can you try adding below script in your onSubmit client script
var desc = g_form.getValue('description');
var start, end, new_desc;
if (desc.includes("The priority value changed to ")) {
start = desc.indexOf("The priority value changed to ");
end = start + 30;
new_desc = setCharAt(desc, end, g_form.getValue('priority'));
g_form.setValue('description', new_desc);
} else {
new_desc = desc + " The priority value changed to " + g_form.getValue('priority');
g_form.setValue('description', new_desc);
}
function setCharAt(str, index, chr) {
if (index > str.length - 1) return str;
return str.substring(0, index) + chr + str.substring(index + 1);
}
Start from a new incident and test it.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-22-2022 07:15 AM
You can try an onSubmit client script as below.
You can only add extra text at the end but you cannot replace the text if it is somewhere in the middle.
function onSubmit()
{
var desc = g_form.getValue('description');
var prio = g_form.getValue('priority');
var new_desc = desc + " The value of priority changed to " + prio;
g_form.setValue('description', new_desc);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2022 11:05 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 01:05 AM
Can you try adding below script in your onSubmit client script
var desc = g_form.getValue('description');
var start, end, new_desc;
if (desc.includes("The priority value changed to ")) {
start = desc.indexOf("The priority value changed to ");
end = start + 30;
new_desc = setCharAt(desc, end, g_form.getValue('priority'));
g_form.setValue('description', new_desc);
} else {
new_desc = desc + " The priority value changed to " + g_form.getValue('priority');
g_form.setValue('description', new_desc);
}
function setCharAt(str, index, chr) {
if (index > str.length - 1) return str;
return str.substring(0, index) + chr + str.substring(index + 1);
}
Start from a new incident and test it.
Mark as correct and helpful if it solved your query.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-26-2022 10:12 PM
Did you get chance to try the above?
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-28-2022 04:35 AM
Did you get chance to try the above?
Regards,
Sumanth