unable set mandatory a field in change request form by using g_form

sumanthpopu
Giga Contributor

unable set mandatory a field in change request form by using g_form

unction onLoad() {
   //Type appropriate comment here, and begin script below
   g_form.isMandatory('short_description',true);
}
5 REPLIES 5

G Ponsekar
Mega Guru

Hi @sumanthpopu ,

 

you need to use g_form.setMandatory('short_description', true); not isMandatory()

 

Also pls review UI policies that is written on short_description field that may conflict

 

Mark correct if it is working for you

 

Thanks,

Trimbakesh
Tera Contributor

Hi,

Check if there is UI policy which makes the field Mandatory false or It can be that the field becoming readonly.

Client Scripts execute before UI Policies. If there's conflicting logic between the two, the UI Policy's logic will take precedence.

VijayaLaksK
Mega Contributor

Hi,

Use the below code once 

g_form.setMandatory('short_description',true); 

prerna_sh
Mega Sage

Hi @sumanthpopu 

 

Use "g_form.setMandatory",  g_form.isMandatory this will not work for setting field mandtory

"setMandatory" function sets the field as mandatory or non-mandatory whereas "isMandatory" function checks whether the field is mandatory or not returns Boolean value.

 

If my response solves your query, please marked helpful by selecting Accept as Solution and Helpful. Let me know if anything else is required.
Thanks,
Prerna