Create multiple RITMs based on list collector variable
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2022 07:02 AM
Hi Team,
I have a requirement for create multiple RITMS using List Collector variable, the variables should copy with in the RITM.
Help me on the same.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-20-2023 10:10 AM
Hi Sumanth,
Add run script activity need to be placed on Request workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2022 09:39 AM
Hi Anil,
update as this and it would set requested_for on RITM with each of the respective user
var opt = current.variables.select_user.toString().split(',');
for (i=0; i < opt.length; i++) {
createRequest(opt[i]); // pass the value here
}
function createRequest(user) {
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('060f3afa3731300054b6a3549dbe5d3e', 1);
cart.setVariable(item, 'employee_type', current.variables.employee_type);
cart.setVariable(item, 'slt_number', current.variables.slt_number);
cart.setVariable(item, 'sales_force', current.variables.sales_force);
cart.setVariable(item, 'requestor', current.variables.requestor);
cart.setVariable(item, 'email', current.variables.email);
cart.setVariable(item, 'location', current.variables.location);
cart.setVariable(item, 'select_computer', current.variables.select_computer);
var rc = cart.placeOrder();
var ritm = new GlideRecord('sc_req_item');
if(ritm.get('request', rc.sys_id)){
ritm.requested_for = user;
ritm.update();
}
}
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
08-16-2022 11:06 PM
Hope you are doing good.
Did my reply answer your question?
If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.
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
09-02-2022 04:54 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
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
10-03-2022 09:39 AM
Hi Ankur,
This is working in my personal instance but not in office instance,
The problem is I selected 2 users in list collector but 20+ RITMS created
Please help me on the same,