How do you make work notes mandatory when a state changes?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2024 10:22 AM
I tried to create a UI policy but there is not action for when a state changes. I want to make work notes mandatory when the states changes from on hold to work in progress
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2024 10:24 AM
Hi @KB30
Try with Client script.
OOTB , when we put INC on hold, additional comments, in same manner we can do our.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2024 10:34 AM
Hello @KB30 ,
You can try below script in you onChange client script.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '' || g_form.isNewRecord())
return;
else if (newValue == oldValue)
g_form.setMandatory("work_notes", false);
else if(oldValue ==3 && newValue==2 )
g_form.setMandatory("work_notes", true);
}Please mark this helpful and accepted if it worked for you.
Thanks
kps sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2024 10:50 AM
How do I add to a UI action I created? I have a UI action button that changes the state to In progress. Script is listed below. I would like to add making worknotes mandatory in this UI action because the client script works separately.
current.incident_state = 2;
current.update();
action.setRedirectURL(current);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-22-2024 10:35 AM
hi @KB30 try this script onChange client script on state field
if (oldValue == 3 && newValue == 2) {
g_form.setMandatory('work_notes', true);
} else {
g_form.setMandatory('work_notes', false);
}
Please mark my answer Helpful/Correct,
Regards,
Siddharam
