We've updated the ServiceNow Community Code of Conduct, adding guidelines around AI usage, professionalism, and content violations. Read more

yes or no

Basina Akash
Tera Contributor

How to auto populate  yes or no question type based on another variable by using client script 

10 REPLIES 10

using the ui policy we can change nature of variable but we need set the values that are yes/No

Hi @Basina Akash 

 

Really sorry, I mis read you problem statement. My bad and apologizes again .

*************************************************************************************************************
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]

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

Hi @Basina Akash 

 

https://www.servicenow.com/community/developer-forum/set-select-box-value-with-yes-no-variable/m-p/1...

 

This may be helpful. 

 

Also Yes/NO is radio button or what type of variable?

*************************************************************************************************************
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]

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

If your question is of type 'Yes/No' then use it like below:

 if (newValue == '1') {
        g_form.setValue('eods_required','No');
        alert('EODS false');
    } else if (newValue == '2' || newValue == '3') {
        g_form.setValue('eods_required', 'Yes');
        alert('EODS true');
    } else {
        g_form.clearValue('eods_required');
        alert('EODS clear ');
    }

 

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

SunilKumar_P
Giga Sage

Hi @Basina Akash, Is your variable type of Yes/No? If yes, then you need to use 'Yes' instead of true.

 

Regards,

Sunil