not understanding if SetMandatory works in script include
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 02:25 AM - edited 11-14-2024 02:27 AM
Hi Everyone,
I am working on Required fields.
Client callable script include
ValidateRequiredFields: function(){
if ((respMsg.toString() === '')) {
respMsg = new sn.RequestUtils().ValidateMyCondition(recordId);
if (respMsg.toString() === 'true') {
respMsg = 'HideField';
} else {
respMsg = 'DisplayField';
}
}
return respMsg;
},
UI action:
My UI action button is present on related table.
Request table
task table
on Task table if i click on a Review button, it should display field on request table.
var gr = new GlideRecord('request');
var due_date = gr.getValue('u_due_date');
if (answer === 'HideField') {
gr.clearValue(due_date);
gr.setMandatory(due_date, false);
gr.setVisible(due_date, false);
} else if (answer === 'DisplayField') {
gr.setVisible(due_date, true);
gr.setMandatory(due_date, true);
}
I am not understanding what is going wrong the mandatory thing not working

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-14-2024 02:29 AM
Can you paste the full code of UI Action and script include.
However, setMandatory is a method in g_form API which is client side but you are using with GlideRecord API which is server side.
Regards,
Sumanth