- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 07:00 PM
I know how to set the maximum number of rows in MRVS.
that is setting "max_rows=X" in Variable Set Attributes.
Then, can I set the minimum number of rows?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 07:10 PM
Hi,
if you want minimum 1 row then you can use Catalog UI policy and make MRVS as mandatory
OR
you can use onLoad catalog client script
g_form.setMandatory('mrvs_name', true);
But if more than 1 minimum row then script
you need to use onSubmit catalog client script and check that
I took example that is minimum 2 rows is required
function onSubmit(){
var json = g_form.getValue('mrvsVariableSetName');
var parser = JSON.parse(json);
var len = parser.length;
if(len < 2){
alert('Please give minimum 2 rows');
return false;
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2022 07:10 PM
Hi,
if you want minimum 1 row then you can use Catalog UI policy and make MRVS as mandatory
OR
you can use onLoad catalog client script
g_form.setMandatory('mrvs_name', true);
But if more than 1 minimum row then script
you need to use onSubmit catalog client script and check that
I took example that is minimum 2 rows is required
function onSubmit(){
var json = g_form.getValue('mrvsVariableSetName');
var parser = JSON.parse(json);
var len = parser.length;
if(len < 2){
alert('Please give minimum 2 rows');
return false;
}
}
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader