Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

SetDisplay() on Variable on HR Form (HR Total Reward case)

JAYESH KUMAR YA
Tera Contributor

Hi All,

Not sure why SetDiplay() is not working on Variables on HR Form but SetVisible() is working.

Any specific Reason or limitation ?


4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

@JAYESH KUMAR YA 

share complete script and config screenshot of your client script or UI policy

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

JAYESH KUMAR YA
Tera Contributor
function onLoad() {
   //Type appropriate comment here, and begin script below
   var testChq = g_form.getValue('test_field');

   if(testChq == 'no'){
    g_form.setDisplay('test_field',false);
   }
}

test_field is a Yes/No field

@JAYESH KUMAR YA 

if any other UI policy with higher order is showing that variable then your script can't hide that

did you check that?

is that variable made mandatory by some other UI policy?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader