not understanding if SetMandatory works in script include

sony8
Tera Contributor

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

1 REPLY 1

SumanthDosapati
Mega Sage
Mega Sage

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