- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 10:43 PM
Hello!
I have the following variables in my catalog item.
Number of Users [1, 2, 3, 4, 5 or more]
Variable 1a
Variable 1b
Variable 1c
Variable 2a
Variable 2b
Variable 2c
Variable 3a
Variable 3b
Variable 3c
and so on...
The requirement. is to create multiple Request Items based on the number of users.
For example, of Number of Users is selected 3 Request Items will be created. 3 Catalog Tasks will also be created. One for each Request Item.
The first RITM and SCTASK will contain Variable 1a, Variable 1b, Variable 1c
The first RITM and SCTASK will contain Variable 2a, Variable 2b, Variable 2c
The first RITM and SCTASK will contain Variable 3a, Variable 3b, Variable 3
Please help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-16-2020 05:24 PM
If you want to create two items under one Request, you would do something like this:
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
var item = cart.addItem('sys if of item');
cart.setVariable(item,'on_behalf_of', userOne);
var item_two = cart.addItem('sys if of item');
cart.setVariable(item_two ,'on_behalf_of', userTwo);
var rc = cart.placeOrder();
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 10:56 PM
There is no simple way to achieve it.
What you can do is the following:
1. Create a Record Producer analog to your catalog item (the record producer is used for the order, the catalog item only for RITM generation)
2. In the Record Producer script, create a RITM vor each of your user/variables (e.g. for each entry in your Multi-Row-Variable-Set)
BTW: In Paris you can select multiple Requested For in a catalog item and for each selected user a RITM is created (works only if all other variables are the same for all RITMs).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 11:05 PM
Is there a way to do it via Run Script in the workflow> This is because for '5 or more' will be processed through a csv file. Meaning if the file contains 50 Users, 50 Request Items will be created.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2020 11:31 PM
You could use the Cart API to accomplish this.
// Sample code
var cart = new Cart();
var item = cart.addItem('e2132865c0a8016500108d9cee411699');
cart.setVariable(item, 'phone', 'pat');
var rc = cart.placeOrder();
gs.print(rc.number);
ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-14-2020 12:18 AM
Is it possible to show only specific variables for one ritm and a different variables for another ritm using the Cart API?