- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 07:13 AM
How can we make Worknotes/Additional Comments mandatory on incident form after clicking on UI action?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 07:19 AM
Hi @Sanket Pawar ,
If u want to make Additional Comments/ Worknotes as mandatory using UI action u need to make that UI action as Client True (click the checkbox for client field) & then u will be able to use this command
g_form.setMandatory('comments',true);
g_form.setMandatory('work_notes',true);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 07:16 AM - edited ‎11-22-2023 07:21 AM
Use client side UI action and make sure the client check box is ticked in the UI action.
Code can be something like this:
g_form.setMandatory('field_name', true);
g_form.save();
If my answer helped you in any way, please then mark it as helpful.
Kind regards,
Kushal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 07:16 AM
Hi @Sanket Pawar ,
You can write below script either on update Business Rule or in UI action:
var commentsField = current.work_notes.toString().trim();
if (commentsField === '') {
gs.addErrorMessage('Worknotes or Additional Comments is mandatory.');
current.setAbortAction(true);
}
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 07:19 AM
Hi @Sanket Pawar ,
If u want to make Additional Comments/ Worknotes as mandatory using UI action u need to make that UI action as Client True (click the checkbox for client field) & then u will be able to use this command
g_form.setMandatory('comments',true);
g_form.setMandatory('work_notes',true);
Thanks,
Danish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2023 08:09 AM
You can use UI policy as well to make it mandatory on condition check.
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]
****************************************************************************************************************