In Service catalog check box field mandtory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 08:02 PM
Hi Team ,
Can anyone please help me here ,
when ever ' Does the request incliude ....... ' is selected Yes . Then ' Select the data domain and check box has to be visible . how to acheive this .
I have written a UI policy which is not working as per my requirement
I haven't selected Yes , but label and checkbox are showing .
can anyone please help me here
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 10:20 PM
Hello @nameisnani ,
The onChange Client Script below will solve your problem. It will hide all the checkboxes on loading also.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
g_form.setVisible('checkbox_1', false);
g_form.setVisible('checkbox_2', false);
g_form.setVisible('checkbox_3', false);
}
// Show or hide checkboxes based on the select box value
if (newValue === 'Yes') {
g_form.setVisible('checkbox_1', true); // Replace 'checkbox1' with your checkbox field name
g_form.setVisible('checkbox_2', true);
g_form.setVisible('checkbox_3', true);
} else {
g_form.setVisible('checkbox_1', false);
g_form.setVisible('checkbox_2', false);
g_form.setVisible('checkbox_3', false);
}
}
Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.
Thanks and Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 12:45 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 01:14 AM
@nameisnani , Can you please confirm the names of those questions? In your code, it seems like you used 'Question' instead of the specific names of those questions.
Also, does the question 'Does the request include sensitive Data Elements?' have a Yes/No type?
Please check the UI type of your script to ensure it is set to All.
Please mark this as "correct" and "helpful" if you feel this answer helped you in anyway.
Thanks and Regards,
Ashish
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-28-2024 11:09 PM
Hi @nameisnani
It simple.. your check box is Mandatory so do one thing.. make is madatory from the same UI policy not from the check box variable.
I guess on the check box you might have selected "selection required" , If yes to uncheck that and create UI policy if you select Yes then it will be hidden or visible as per you r reqiornment
If you found my response helpful, I would greatly appreciate it if you could mark it as "Accepted Solution" and "Helpful."
Your support not only benefits the community but also encourages me to continue assisting. Thank you so much!
Thanks and Regards
Ravi Gaurav | ServiceNow MVP 2025,2024 | ServiceNow Practice Lead | Solution Architect
CGI
M.Tech in Data Science & AI
YouTube: https://www.youtube.com/@learnservicenowwithravi
LinkedIn: https://www.linkedin.com/in/ravi-gaurav-a67542aa/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-29-2024 12:45 AM