Setting Short Description using Inbound Email with Cart API

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2016 11:33 AM
I'm receiving email from HR system and using Inbound Email Action with Cart API for Associate Onboarding. It works perfectly; however, I'm unable to change the short description. I would like to set the short description = to the email subject (Associate On Boarding, John Doe). I'm using the email and script below. But, it keeps defaulting to the short description on the Catalog Item. I've also tried using the Field actions, but this results in the creation of a second RITM. Any help would be appreciated. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2016 03:18 PM
The short_description field of an sc_req_item record is set in the proprietary code. You could write an after/create Business Rule to change the value after the fact using the value that comes through in your variable. This would be a departure from the standard method of doing things obviously, but I'm sure you've considered that. Normally each requested item short description refers to the generic catalog item that was requested but I don't see any intrinsic reason it couldn't be more specific. Good luck!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2016 06:01 PM
Hi gaf627
Add this code after the line var rc=cart.placeOrder();
var gr= new GlideRecord('sc_req_item');
gr.addQuery('request',rc.sys_id);
gr.query();
while(gr.next()){
gr.short_description=email.subject;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-17-2016 08:08 AM
Hi Abhinay,
I added your code, which resulted two RITMs with same record number being added to the request. The 2nd one has the short description. This gets me closer, but creates a larger issue by having RITMs with the same record number.
createRequest();
function createRequest() {
var cart = new Cart();
// add in cart, substitute your cat item sys_id
var item = cart.addItem('c6b40cc86f262200739d841dba3ee4ba');
//Look up the user table for someone with the same name.
var user = new GlideRecord('sys_user');
if(user.get('email', email.body.supervisoremail))
{
//Found the users with a matching name,
cart.setVariable(item, 'requested_for', user.sys_id);
}
else
{
//No matching user
cart.setVariable(item, 'requested_for', '67cb84cc6f262200739d841dba3ee424');
}
//Set Variables in your Cart Item
var cartmsg = "received from: " + email.origemail + "\n\n" + email.body_text;
cart.setVariable(item,'comments',cartmsg);
var rc = cart.placeOrder();
var gr= new GlideRecord('sc_req_item');
gr.addQuery('request',rc.sys_id);
gr.query();
while(gr.next())
gr.short_description=email.subject;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-18-2016 06:46 AM
It worked for me on my instance. It only updated the existing ritms