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

Not applicable

Hi All,

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

Any specific Reason or limitation ?


1 ACCEPTED SOLUTION

@Community Alums 

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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

4 REPLIES 4

Ankur Bawiskar
Tera Patron

@Community Alums 

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

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

Not applicable
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);
   }
}

Not applicable

test_field is a Yes/No field

@Community Alums 

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  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader