How to set check box value default as true when page loads

Bala13
Kilo Guru

HI @Ankur Bawiskar 

We have a maintain item in which we have a variable set. 

There are multiple checkboxes available. In that i need Desktop variable set to default as true. It is checkbox type.

I tried using true in default value as true in that variable, but it is not working.

There are few more checkboxes for which default value is not set as true, but they are working by default as true. 

Please help me to fix this issue.

find_real_file.png

 

find_real_file.png

 

find_real_file.png

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Did you give true or TRUE in the default value?

Did you compare with other variable?

Any onLoad script is unchecking that?

Regards
Ankur

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

@Ankur Bawiskar 

 

I have given 'true' in that desktop variable form.

I ahve compared with other variables which is functioning as default. But there is no value set on those variables to make it default as true.

 

There were no onload scripts existed here.

How can i make desktop variable as default to true when onloading the page? Please help me to fix the issue

Hi,

Please check there must be some onLoad client script or UI policy in variable set or on catalog item which setting these variables value to true.

If you want to check these checkboxes for your item then create onLoad client script and use below logic:

g_form.setValue('laptop',true);
g_form.setValue('laptop',true);

 

Thanks,
Anil Lande

Please appreciate the efforts of community contributors by marking appropriate response as correct answer and helpful, this may help other community users to follow correct solution in future.
Thanks
Anil Lande

Hi Anil,

 

I have tried the same logic in catalog client script on variable set/ catalog item as well.

But its not setting to default true.

please help me to fix the issue