Need help to make field mandatory in multirow variable set
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 05:45 AM
Hi Everyone , I have a requirement on catalog item , we have two variable and a multirow variable set(Test1) on catalog item. Our requirement is when we select 1 in first variable (Copier paper) and 2 in second variable (
Pens) then Field1 inside multirow variable set should become mandatory. Please see screenshot below
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 10:19 PM
You should refer this
https://docs.servicenow.com/bundle/rome-application-development/page/app-store/dev_portal/API_reference/g_service_catalog/concept/g_service_catalogClientAPI.html
Try putting in a client script onLoad or onChange as per you need & check the parent variable value using below
g_service_catalog.parent.getValue("your_variable")
Then make the variable set variables mandatory as reuired
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2023 10:01 AM
Hi Sumit,
Could you please share the screen shot how to full fill the requirement
is both variable sets are MRVS or (one single row another one MRVS)
if one is single row and another one MRVS then it is working?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-25-2022 11:32 PM
I just created variables names "copier_paper_reams" and "pens_box_of_10" on the form.
Created variable sets with fields "field1" and "field2".
Created client script in variable set.
function onLoad() {
try {
var copier = parent.g_form.getValue('copier_paper_reams');
var pens = parent.g_form.getValue('pens_box_of_10');
if (copier == 1 && pens == 2) {
g_form.setMandatory('field1', true);
}
} catch (e) {
alert(e.message);
}
}
Execution result:
1. When copier paper (reams) = 1 and Pens (box of 10) = 1
2. When copier paper (reams) = 1 and Pens (box of 10) = 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 09:04 PM
Hi Hitoshi,
What if these variables copier_paper_reams and pens_box_of_10 are in different variable set on same catalog then how access them?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-26-2022 11:34 PM
I see that this has already been made into a new question.
Will assume that my reply here has answered the question here. Will therefore reply in the new question thread.