The CreatorCon Call for Content is officially open! Get started here.

Email logs is not updating the target field after an inbound email action is processed

rev3
Mega Expert

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 !

Target.PNG

Thank You

Rev@

7 REPLIES 7

Rozi
Kilo Contributor

Hi Rev,

You can add below code at the end of inbound action to update "target table" and "target" 

 

    var email_log = new GlideRecord('sys_email');
    email_log.query('uid', email.uid);
    email_log.orderByDesc('sys_created_on');
    email_log.query();
    if(email_log.next()) {
      email_log.target_table = "sc_req_item";
      email_log.instance=reqItemSysId;
      email_log.update();
    }
 
Note: reqItemSysId is sys_id of requested item
 
 
Thanks,
Rozi
 
PS: Hit like/helpful if you found this correct or useful

Thank you so much Rozi. I applied this code in my Inbound and now the Target field is populated with the record.

 

I highly appreciate!

Ruturaj Shirsat
Mega Expert

Hi All,

Did someone find any solution for this?

 

Thanks,

Ruturaj