Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to update short description and Description in REQ using inbound emails

Renu9
Tera Contributor

Hi All,

I am triggering a catalog item using an inbound email action where in a request gets created. But I see request short description and description fields are empty.

Inbound email is on sc_cart table. I am writing short description and description values in RITM and also in SCTask using the workflow which is on RITM table. Please guide me how to achieve of a short description and description values in REQ record.

 

var cartId = GlideGuid.generate(null);

    var cart = new Cart(cartId);

    var item = cart.addItem('a9503cff875e059025d00fe60cbb3584'); // Catalog item sys_id 

              

                 cart.setVariable(item, 'employee_no', email.body.employee_number.toString());

                 cart.setVariable(item, 'employee_name', email.body.employee_name.toString());

                 cart.setVariable(item, 'country', email.body.country.toString());

       var rc = cart.placeOrder();

 

6 REPLIES 6

Hi, can you show me what you did as I ahve the same issue and not finding any solution in community or docs.....?  Thanks

Jaspal Singh
Mega Patron
Mega Patron

Considering 

var rc = cart.placeOrder();

will give your RITM no. can you try adding below

var ritmis=new GlideRecord('sc_req_item');
ritmis.addQuery('sys_id',rc.sys_id);
ritmis.query();
if(ritmis.next())
{
var reqis=new GlideRecord('sc_request');
reqis.addQuery('sys_id',ritmis.request);
reqis.query();
if(reqis.next())
{
reqis.short_description='ABC text here';
reqis.description='ABC text here';
reqis.update();
}
}