Inbound action - New email update existing ticket

peterquiroz
Giga Contributor

I'm trying create a new inbound action that will update a ticket from a user. User who is not in registered in the system, it can be anybody. So it's not really a reply to email, it's more of a new email with ticket or request number. Any suggestions?

Name: New Hire equipment Shipping update

Target table: "New Hire Asset..."

Type: New -- ??

Condition: email.subject.startsWith("NHA0")

gs.include('validators');

if (current.getTableName() == "New_hire_Asset") {  

  current.u_email_body = "reply from: " + email.origemail + "\n\n" + email.body_text;

}

emailbody = email.body_text.trim().replace('<br>','');

  current.update();

~Peter

1 ACCEPTED SOLUTION

jose_valle
ServiceNow Employee
ServiceNow Employee

Hi Peter,



In this case, because the email is not classified as a reply "current" will represent a new record in the table for which the inbound action is configure.   In order to update the appropriate record, you will need to add code to your inbound action to find and update the correct record using GlideRecord based on values you check for in the subject or body of the email depending on what you are expecting it to contain.



Hope this helps.


-Jose


View solution in original post

5 REPLIES 5

peterquiroz
Giga Contributor

Thanks guys. Forgot to provide an update. I found a way to do it.


email.subject.indexOf("NHAR") ==0