Hi Everyone, My below code is not working in the page...can someone help me with the error in the
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 08:40 AM
var act = g_form.getValue('u_active');
if (act == true){
g_form.setMandatory('u_location',true);
}
else if(act == false){
g_form.setMandatory('u_location',false);
}
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2025 08:45 PM
are you sure the script is running in correct view?
try this
var act = g_form.getValue('u_active').toString();
if (act == 'true'){
g_form.setMandatory('u_location',true);
}
else if(act == 'false'){
g_form.setMandatory('u_location',false);
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader