Script to add multiple RITM to single request
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-03-2023 12:15 PM
Hi ,
Is there a script to add multiple RITMS to single request? My requirement is that the catalog item can have multiple users in a variable and for each user a separate RITM has to be created under a single REQ
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-04-2023 06:24 AM
If you've got a workflow associated with your catalog item then add the following script in the Run script activity
var users = current.variables.variable_name;
for(var i = 0 ; i< users.length ; i ++){
var createRitm = new GlideRecord('sc_req_item');
createRitm.initialize();
createRitm.setValue('cat_item', current.getValue('cat_item'));
createRitm.setValue('request', current.getValue('request'));
createRitm.insert();
}
If I could help you with my response you can mark it as helpful and correct as it benefits future viewers
Thanks,
Sai Kumar B
Community Rising Star 2023 & 2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-05-2023 01:53 AM
Hi,
We should use cart API to achieve this.