setDisplay() function is not working

Naveen Kumar
Tera Contributor

in a catalog client script , 

I am able to hide a filed using g_form.setVisble('requested_by',false);

But I want to use  g_form.setDisplay('requested_by',false); so that the space will be used for other field.

15 REPLIES 15

Sagar Pagar
Tera Patron

Hi,

Make sure that other Catalog UI policies on same field are not conflicts and make it as visible.

 

Feel free to mark helpful and correct!

Thanks,

Sagar pagar

The world works with ServiceNow

hi

My question is 

I am able to hide the field using setVisible() but I am not able to using setDisplay() function,

I need to know why.

Hi,

1) Did you try to hide it through the Catalog Ui policies?

2) Also check if any fields are supposed to be mandatory and because of which the field is not showing up/hiding.

 

Thanks,

Sagar Pagar

The world works with ServiceNow

Hi,

I cannot use Ui Policy.

Because I need to use 1 condition here: 

function onLoad() {
  
    var cat = g_form.getUniqueValue();
    
        {
            
            if(cat == '0100714f1be85d500af31173b24bcb0f') // Customer service review catalog item
                
                
            {
                
                g_form.setDisplay('requested_by',true);
                
                


            }
            
            else
                {
                    
                    g_form.setVisible('requested_by',false);
                }
        }
}

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

what's the variable type?

share the screenshot and complete script

Regards
Ankur

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