Make Worknotes Mandatory , if Impact or Urgency gets updated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 10:37 PM
Hi All ,
I have a requirement , where I need to make work-notes mandatory when the values of impact or urgency field changes.
The default value of Impact = 5 and Urgency = 5 which will be set when the incident form is opened , I want the work notes to be mandatory only if the default values for impact or urgency is changed .
If the Save or Update buttons are clicked after changing the Impact or Urgency values and before typing a Work note, then an error should be displayed . . . The following mandatory fields are not filled in: Work notes .
How can I implement this scenario ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 11:17 PM
Hi @Ankur Bawiskar -- This is happening before I click on the save button , for example while opening an Incident form , I just change the impact or urgency from 5 to 2 and then back to 5 again which are the default values for these two fields and then click on save during that time its showing me as work notes mandatory ..
In ideal scenario it should only show as mandatory when the value has been changed from 5 to 2 and then the save button is clicked .
Also the work notes should be mandatory as many times as the values of these fields are changed .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 11:22 PM
then you need to make it non-mandatory when it again changes to 5 which is the default value
something like this
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading)
return;
if(newValue != 5)
g_form.setMandatory('work_notes', true);
else
g_form.setMandatory('work_notes', false);
}
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
04-21-2024 11:28 PM
Hi @Ankur Bawiskar - Ok I will look on the client side
and on the API side I have a requirement , where work notes should be mandatory while creating an incident using API and also updating an Incident via API if the impact or urgency field changes
This is the Business rule I have written for it :
Is this correct ?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-21-2024 11:37 PM
both are different questions. you can post it as separate question.
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
04-22-2024 12:26 AM
Hi @Ankur Bawiskar - I tried with the script , it worked for the scenario where :
the value of urgency or Impact was changed from 5 to 2 before saving and again back to 5 it worked correctly here
but on scenarios where it was changed from 2 to 5 after saving the incident form .. anytime the value of urgency or impact is changed to 5 after saving the form its not making it as mandatory here .
How can I fix that?