Email logs is not updating the target field after an inbound email action is processed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 02:04 PM
Hello All,
I have created an inbound email action to Create a Request and Requested Item in Catalog when an email is received into servicenow. I have set Target Table as: Shopping Cart(sc_cart)
The Script work well and it creates a Request and Request Item. But my When i see the email logs from System Logs-->Emails and open the received email. Here the Target field is not populating the Requested Item or Request Number.
My Question is, Is there a way that i can populate the target field with RITM Number in the email log.
Any Pointers would be helpful !
Thank You
Rev@

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2016 02:16 PM
Hi Rev,
Target is a document id field and it needs to be set differently
i.e set instance value to requested item or request number
and then set table as request or requested item depending on what value you set for instance.
Sample script : Adjust it as per your need
var gr = new GlideRecord('sys_email');
gr.get('81404e364fc0a200bbc32d118110c75c'); //queries one record from email log
gr.instance = 'b3d7a9b64f7b1200bbc32d118110c741'; //sys_id of incident
gr.table = 'incident'; //table name of incident
gr.update();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2016 08:50 AM
Hello Pradeep,
Thank You for the reply.
I have tried your script and it did not work. May be i am missing something here. Also i have noticed that though my inbound action kicks off, the email logs does not validate that it has been processed. My inbound email script as follows:
Target Table: sc_req_item
Script:
**********************************
var sid = new GlideRecord('sys_user');
sid.get('email' , email.from);
var loc = new GlideRecord('cmn_location');
loc.get(sid.location);
var hddcart = new Cart();
var item = hddcart.addItem('sys_id_of_the_item' , 1);
hddcart.setVariable(item, 'requested_for', sid.sys_id);
hddcart.setVariable(item, 'requested_for_name'. sid.name);
hddcart.setVariable(item, 'requested_for_location', loc.name);
hddcart.setVariable(item, 'short_description', email.subject.toString());
var cartmsg = "Received from: " + email.origemail + "\nSent to:" + email.to + "\n\nSubject: " + email.subject + '\n' + email.body_text;
hddcart.setVariable(item, 'additional_info', cartmsg);
hddcart.placeOrder();
******************************************
Later i have added current.update(); in the end of the script. When i add this the email logs says that inbound action is processed and also the target is set with Request Item Number. In this case there is no additional script required. But adding current.update is creating a new item number for my script. Do i have to change anything in my script?
Appreciate your time and efforts !
Thanks Again
Reva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-18-2017 07:32 AM
Hi Rev,
Were you able to find the solution for this issue. It would be helpful if you could post it here.
Thanks,
Dedeepya
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2019 03:15 AM
Hi Rev,
Did you manage to resolve the issue?
I have similar problem here...