schedule job to create request item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 07:53 AM
How to create a request item from schedule job with the Request field of Requested item filled automatically.
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 08:31 AM
Hi Rahul,
Use the below script in scheduled job to create an ritm for a catalog item and it will auto set the Request field
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//give sys_id of catalog item
var item = cart.addItem('a1e88857db3132003ec57e7dbf96190f', 1);
cart.setVariable(item,"u_requested_for", gs.getUserId());
var rc = cart.placeOrder();
Please mark answer correct/helpful based on Impact.
Thanks,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 09:44 AM
can you tell me why 1 is placed in
var item = cart.addItem('a1e88857db3132003ec57e7dbf96190f', 1);
here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2022 12:35 AM
For creating one request only for the particular record
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-04-2022 09:54 PM
Requested for is not displaying any value , it is showing as empty.
i have set this according to my names
cart.setVariable(item,"requested_for", gs.getUserID());
please help