- 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
ā09-03-2024 10:07 PM
Thanks for the time for replying , appreciate it much...
but I already found another class for RITM creator which is already built-in to SN
and would like to share it to our community ..
i'm currently using this object incorporate with your code given .. and so far so good..
// THIS is where new RITM is created