- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 04:48 AM
Hi everyone !
please i have a quick question, When i make a variable set to mandatory will it make the variables inside mandatory too or i need to set them mandatory
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-02-2025 11:27 PM
Hello @GhitaB ,
Yes, you’re right — if you set the variable set as mandatory using a catalog-level UI policy, all the variables within that set will automatically become mandatory as well. This can save you from having to mark each variable individually, especially if you intend for all of them to be required anyway.
Just make sure you're applying the UI policy at the catalog item level. I quickly tested this behavior and have added a few screenshots below for reference. Hope this helps!
Before applying the UI policy:
UI Policy Action:
After applying the UI policy:
Hope this helps — feel free to reach out if you have any follow-up questions!
🔹 Please mark ✅ Correct if this solves your query, and 👍 Helpful if you found the response valuable.
Best regards,
Aniket Chavan
🏆 ServiceNow MVP 2025 | 🌟 ServiceNow Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 09:44 AM
actually i have another issue that i need to set some mandatory fields inside that MRVS :
function onSubmit() {
var country = g_form.getValue('subject_country');
if (!country || country.toLowerCase() !== 'australia') return true;
var emergencyName = g_form.getValue('emergency_name');
var relationship = g_form.getValue('emergency_relationship');
var address = g_form.getValue('residential_address');
var eCountry = g_form.getValue('emergency_country');
var mobile = g_form.getValue('phone_mobile');
if (!emergencyName || !relationship || !address || !eCountry || !mobile) {
spModal.open({
title: "Missing Information",
message: "Please complete all required Emergency Contact fields before adding the row.",
buttons: [{ label: "OK", primary: true }]
});
return false;
}
return true;
} the problem i'm facing that it worked when i remove the country condition cause the subject country exist in the catalog item and i guess it's not getting catched inside the modal of the MRVS what to do in the case cause i need to make them mandatory for a specific country
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 12:40 PM
@GhitaB Let’s try to simplify things a bit — I got a little confused reading your last response, so just want to make sure I’ve understood correctly before helping further.
From what you shared, it seems like you want to make some fields inside an MRVS mandatory, but based on the value of a variable that’s outside the MRVS — specifically subject_country, right?
If that’s the case, I’m wondering why you’re not using an onChange client script on subject_country itself? That way, based on the selected value (like "australia"), you could directly set the inner MRVS variables as mandatory — which would enforce validation while filling out the form, rather than only at submission. It’s generally a cleaner user experience too, since users know right away what’s required.
Anyway, if you still prefer the onSubmit approach, that’s totally fine — just wanted to check in case you’re open to an alternate method.
Also, just to confirm:
subject_country is the field outside the MRVS and it’s the deciding factor.
The following variables are inside the MRVS and need to be mandatory only when subject_country == 'australia', right?
1. emergency_name
2. emergency_relationship
3. residential_address
4. emergency_country
5. phone_mobile
If all that’s correct, just let me know and I’ll help you with the exact script/logic. And if anything’s off, feel free to correct me — no worries at all!
🔹 Please mark ✅ Correct if this solves your query, and 👍 Helpful if you found the response valuable.
Best regards,
Aniket Chavan
🏆 ServiceNow MVP 2025 | 🌟 ServiceNow Rising Star 2024
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-03-2025 12:44 PM
yes exactly that's what i want to do