Below script in nor working correctly
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 09:20 AM
Hi All,
I have written below inbound email action script on sc_req_item table
by using that 2 request are created 1 with proper catalog item and another one in without catalog item please let me know what is issue in my script.
Thanks & Regards
KP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 09:46 AM
Try instantiating the cart with a unique ID
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 09:54 PM
Hi Brad,
After using that only one ticket has been created but without item. kindly find below screen snap.
Regards,
KP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 10:17 PM
Hi @keval3 ,
Use below code.
var id = GlideGuid.generate(null); // Generate a unique GUID for the cart
var cart = new Cart(id); // Instantiate a new cart with the GUID
var item = cart.addItem('Put sys_id of your catalog ite.');
cart.setVariable(item,'put your variable name ','your variable value');
cart.setVariable(item,'put your variable name2 ','your variable value2');
var request = cart.placeOrder();
//Example...
// Add the catalog item using its sys_id
var RITM = cart.addItem('060f3afa3731300054b6a3549dbe5d3e'); // sys_id of the catlog item
// Set variables for the catalog item
cart.setVariable(RITM, 'ram', '16'); // RAM size
cart.setVariable(RITM, 'os', 'win10'); // Operating system
cart.setVariable(RITM, 'storage', '1tb'); // Storage capacity
// Place the order
var request = cart.placeOrder();
You can visit https://servicenowwithrunjay.com/create-ritm-using-cart-api-in-servicenow/ for more detailed info.
-------------------------------------------------------------------------
If you found my response helpful, please consider selecting "Accept as Solution" and marking it as "Helpful." This not only supports me but also benefits the community.
Regards
Runjay Patel - ServiceNow Solution Architect
YouTube: https://www.youtube.com/@RunjayP
LinkedIn: https://www.linkedin.com/in/runjay
-------------------------------------------------------------------------
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-06-2024 10:39 PM
Hi Runjay,
I apply your code in my inbound as you can see in below screen snap 3 tickets has been create at same time.