g_form.setMandatory(<variableset>,false) not working after upgrade to Orlando

Luke Turner1
Mega Guru

Since upgrading to Orlando the following script has stopped working on the portal:

g_form.setMandatory("<variable set>", false);
g_form.setDisplay("<variable set>", false);

After playing with it I found that it was just the setMandatory that is not working, I'm not sure if this is intentional or a bug with Orlando.

Are there any other ways of doing the same thing without having to set all variables to be not mandatory individually as there are a quite a few variable and they might change at a later stage.

1 ACCEPTED SOLUTION

ServiceNow have told me that they have raised a problem and are targeting a fix for Paris.

View solution in original post

9 REPLIES 9

can you try with setVisible() instead of setDisplay()

 

https://hi.service-now.com/kb_view.do?sysparm_article=KB0718679

Hi Luke,

I am able to reproduce this in my Orlando version

Script Used: Catalog Client Script on Variable Set

function onLoad() {
   //Type appropriate comment here, and begin script below
   
    g_form.setMandatory('user_details', false);
    g_form.setDisplay('user_details', false);
    
}

Script which worked: I used individual variables

function onLoad(){

   //Type appropriate comment here, and begin script below

g_form.setMandatory('name', false);
    g_form.setMandatory('email', false);
    
    g_form.setDisplay('name', false);
    g_form.setDisplay('email', false);

}

find_real_file.png

find_real_file.png

It hides the variables by 1st making it mandatory false and then hiding using that in native but not working in portal view

Working in Native View:

find_real_file.png

Not Working in Portal View:

find_real_file.png

If that was working in previous version please raise a HI ticket with ServiceNow. I don't have any other PDI to test this out.

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

Ye this is the exactly what I found as well, and yes this was working pre-upgrade so I have raised a Hi Portal ticket.

I will update this if I get an answer from ServiceNow.

Thanks.

Hi Luke,

Did you get an update?

Regards
Ankur

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

ServiceNow have told me that they have raised a problem and are targeting a fix for Paris.