Unable to Set "Work Notes" mandatory for sc_task table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
8 hours ago
Hi @everyone,
Can any one help me on how to make mandatory "work notes" in sc_task table by using UI action. I tried i am able to set "Notes" section instead "work Notes".
function onclieck(){
g_form.setmandatory('work_notes');
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
As already said your syntax is wrong
š” If my response helped, please mark it as correct ā and close the thread šā this helps future readers find the solution faster! š
Ankur
⨠Certified Technical Architect || ⨠10x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago - last edited 7 hours ago
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
7 hours ago
Hello @CharanV66187530
1. The spelling of click is incorrect.
2. When you use setMandatory('field_name', 'you specify here as true or false');
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
6 hours ago
Work Notes is not a normal field, it belongs to journal fields.
g_form.setMandatory() does not work reliably on journal fields like work_notes and comments. Thatās why itās not enforcing.
Use g_form.getValue() and block submission. Try below code it may work for you
function onClick() {
var notes = g_form.getValue('work_notes');
if (!notes) {
g_form.addErrorMessage('Work Notes is mandatory');
return false; // stop action
}
// allow action
return true;
}
Regards,
VaniMadhuri
