How to set check box value default as true when page loads
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 10:13 PM
HI
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.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 10:24 PM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 10:28 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 10:31 PM
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
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-21-2022 11:00 PM
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