- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-23-2020 04:07 AM
Hi
I have a requirement, where I have to create multiple request items under a single request using one catalog form.
If the User has selected check-boxes then request item has be created, if does not check any of check-boxes then one RITM has be created.
Requirement is something similar to the Order Guide - New Hire
Thanks,
Kumar
Solved! Go to Solution.
- Labels:
-
Service Catalog

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-23-2020 06:15 AM
you have to first identify here the number of check box have been checked and based on that using for loop you can create the extra RITM on your request.
Adding Sample code here. use the below code on your workflow run script activity, Give a try.
var dd = current.variables.check_box;
var dd1 = current.variables.check_box1;
var dd2 = current.variables.check_box2;
var mandatoryVars = [dd,dd1,dd2];
var numTrue = 0;
for (var x = 0; x < mandatoryVars.length; x++) {
if (mandatoryVars[x] == 'true') {
numTrue ++;
}
}
for(var i = 0 ; i< numTrue ; i ++){
var gr = new GlideRecord('sc_req_item');
gr.initialize();
gr.cat_item = current.cat_item;
gr.request= current.request;
gr.insert();
}
If my answer helped you, kindly mark it as correct and helpful.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-23-2020 06:15 AM
you have to first identify here the number of check box have been checked and based on that using for loop you can create the extra RITM on your request.
Adding Sample code here. use the below code on your workflow run script activity, Give a try.
var dd = current.variables.check_box;
var dd1 = current.variables.check_box1;
var dd2 = current.variables.check_box2;
var mandatoryVars = [dd,dd1,dd2];
var numTrue = 0;
for (var x = 0; x < mandatoryVars.length; x++) {
if (mandatoryVars[x] == 'true') {
numTrue ++;
}
}
for(var i = 0 ; i< numTrue ; i ++){
var gr = new GlideRecord('sc_req_item');
gr.initialize();
gr.cat_item = current.cat_item;
gr.request= current.request;
gr.insert();
}
If my answer helped you, kindly mark it as correct and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-25-2020 07:27 AM
Thank you Harshvardhan š
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā10-05-2020 03:27 AM
Hi Harshavardan,
I'm having same requirement but here there is one error i'm facing, that is when i click on two checkbox then also it's creating three RITM's , but it should create two ritm's and workflow not getting attached.
how this can rectify.
thanks,
JRY
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā11-30-2020 12:04 PM
Hi
Did u found a way to solve the creation of 3 ritms?