How to set the default value as No for Yes/No type catalog variable

Hemamani Prabha
Tera Contributor

Hello all,

This seems to be an easy one but it isn't working.

I have created an Yes/No type catalog variable for a catalog item. Here, I wanted to default the value as "No" which I already tried but it is not working.

HemamaniPrabha_0-1743695451916.png

 

In the form it is setting as Yes by default though I have given No in the default value. Why ? Can someone help?

HemamaniPrabha_1-1743695537458.png

Thanks,

Hema

 

1 ACCEPTED SOLUTION

Chaitanya ILCR
Giga Patron

Hi @Hemamani Prabha ,

 

check if you have any catalog ui policies or client script which clears the value of that variable on load.

check the client scripts where g_form.clearValue() is used to clear that value of that variable

check if there is any UI policy with onLoad checked and clear value checked on ui policy action or ui policy script

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

View solution in original post

4 REPLIES 4

Dr Atul G- LNG
Tera Patron

Hi @Hemamani Prabha 

It should work. Do one thing: make this variable inactive, create a new one, and then test it.

 

https://www.servicenow.com/community/developer-forum/i-have-a-yes-no-variable-and-i-set-quot-no-quot...

 See @Allen Andreas  response.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

Robbie
Kilo Patron

Hi @Hemamani Prabha,

 

For a reference point, you can check an Out Of Box (OOB) Catalog Item such as 'New Hire' where the 'Will this be a remote employee?' variable (name: remote) is a Type of Yes/No.

OOB it is set to no with the value of No.

Can you try clearing the value and set it back to No ensuring the is no leading or trailing space in the value.

Additionally, you'll want to check that anything scripts etc are not clearing the value inadvertently.

 

See screen shots below for guidance for OOB configuration.

 

To help others (and for me to gain recognition for my efforts), please mark this response correct by clicking on Accept as Solution and/or Kudos.


Thanks, Robbie

Screenshot 2025-04-03 at 17.40.02.png

Screenshot 2025-04-03 at 17.36.33.png

Chaitanya ILCR
Giga Patron

Hi @Hemamani Prabha ,

 

check if you have any catalog ui policies or client script which clears the value of that variable on load.

check the client scripts where g_form.clearValue() is used to clear that value of that variable

check if there is any UI policy with onLoad checked and clear value checked on ui policy action or ui policy script

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

Thank you @Chaitanya ILCR  This helped.

Yes there was a catalog client script clearing the value. Now it's working fine 🙂