what is difference of Set Mandatory and Is Mandatory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2020 12:00 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2020 02:16 PM
Hi Ajay,
setMandatory function sets the field as mandatory or non mandatory whereas isMandatory function checks whether the field is mandatory or not returns Boolean value. Sample codes with comments are below:
g_form.isMandatory('field_name');// returns true is field is mandatory and false if the field is non mandatory
g_form.setMandatory('field_name',true);//sets the field as mandatory.
g_form.setMandatory('field_name',false); //sets the field ad non mandatory.
Kindly mark my answer as Correct and Helpful based on the Impact.
Regards,
Chaitanya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-26-2022 07:37 AM
yes, that's correct..
function onLoad() {
g_form.setMandatory('caller_id',false);
g_form.setMandatory('description',true);
g_form.isMandatory()
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-27-2024 08:42 AM
g_form.isMandatory('field_name'); it is showing false on mandatory fields also??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2020 02:49 PM
Here is the official doc for glideform API.
https://developer.servicenow.com/app.do#!/api_doc?v=newyork&id=r_GlideFormIsMandatory_String
Please mark my response as correct and helpful if it helped solved your question.
-Thanks