- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 04:04 AM
Hi Team,
I have created one child RITM ticket using workflow (Run script) for creation of variables to display in case details section, I have used below script
And this is not working what I am expecting
Could you please let me know the solution, please share any script which will work for this scenario.
Thank you in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 05:52 AM - edited 02-22-2024 05:53 AM
is this working form background scripts?
Can you try the below to see if this works
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//add your requested item to the cart by sys_id of the catalog item
var item = cart.addItem('4054428fdb151f0097679ec6db9619c0', 1);
//fill in the variables on the request item form
cart.setVariable(item,"u_requested_for", "e80edd6edbec6bc097275e25ca9619a4");
cart.setVariable(item,"contact_number", "0");
cart.setVariable(item,"assignment_group", "87ec1c342b2e71406c487fb5a8da1524");
cart.setVariable(item,"application_service", "cdedfbcedb0f9744c291c170ba9619a7");
cart.setVariable(item,"short_description", email.subject);
cart.setVariable(item,"description", email.body_text);
var rc = cart.placeOrder();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 05:52 AM - edited 02-22-2024 05:53 AM
is this working form background scripts?
Can you try the below to see if this works
var cartId = GlideGuid.generate(null);
var cart = new Cart(cartId);
//add your requested item to the cart by sys_id of the catalog item
var item = cart.addItem('4054428fdb151f0097679ec6db9619c0', 1);
//fill in the variables on the request item form
cart.setVariable(item,"u_requested_for", "e80edd6edbec6bc097275e25ca9619a4");
cart.setVariable(item,"contact_number", "0");
cart.setVariable(item,"assignment_group", "87ec1c342b2e71406c487fb5a8da1524");
cart.setVariable(item,"application_service", "cdedfbcedb0f9744c291c170ba9619a7");
cart.setVariable(item,"short_description", email.subject);
cart.setVariable(item,"description", email.body_text);
var rc = cart.placeOrder();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 06:29 AM - edited 02-22-2024 06:40 AM
@Anurag Tripathi
Wow it's worked, but please let me know how to set RITM field values through this cart
Example : service offering, Business service details
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 06:44 AM
Once the ritm is created you cna get back to update those values.
rc should have the ritm sysid
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 07:26 AM
No, client is expecting to map those fields before
please let me know how can we achieve this ?
The above field is not mapping, even I used current.variables.cmdb_ci.getDisplayValue()
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-22-2024 07:41 AM
This is like submitting the cart , but via script, so on a catalog item you only have variables that you can select , so that is pretty much the same you can do with script.
If You can identify based on something condition when you submit it via script then you can create a before insert BR and populate the fields using that.