Inbound action to update Case from a Froward email
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2020 08:53 AM
Hi,
We would like to be able to update Cases and Incidents from emails that have been forwarded.
If an end user forwards an email with the watermark and ref number in the subject then we want the case or incident to be updated just like a reply email does.
I have tried to create a new inbound action with the type set of forward and use the same code from the "Update Case via reply" but it doesn't update the case, instead it creates a new case.
I would appreciate any help.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2020 12:03 PM
Hi Chris,
Your code looks perfectly fine to me. I suspect you are getting blank in first line. Can you add some text in comments field also for testing purpose so that you will get where it's going wrong.
//if case.state = resloved (6), then check first word in body for accept or reject
//else if case.state = Awaiting (18), then, move to open state
var case_state = current.state;
if (current.state == 6) {
var lines = email.body_text.split('\n');
var firstword = "";
if (lines.length > 0)
firstword = lines[0].replace(/^\s+|\s+$/g, '');
firstline = firstword.toLowerCase();
if (firstline) {
if (firstline.indexOf("reject") == 0)
current.state = 10;
else if (firstline.indexOf("accept") == 0)
current.state = 3;
}
current.comments = "Resolved state first line:"+firstline+"First word: \n"+firstword;
} else if (current.state == 18) {
current.state = 10;
current.comments = "Awaiting state moved to Open state";
} else {
current.sys_updated_on = "";
current.comments = "Case is neither in Resolved state nor in Awaiting state.";
}
current.update();
If it helps, please mark ✅ Correct and 👍 Helpful.
Thanks & Regards,
Madhav.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2020 12:56 AM
Hi Madhav,
I changed the code on the Inbound action to the code you gave me. I then sent another forward email with the same watermark and ref number in the subject line.
As before instead of updating the original case, it created a NEW case with the following
in the comments. I hope this helps your understanding of what is going on.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2020 03:25 AM
Hi Chris,
Seems like ServiceNow updates the existing cases through "Reply" emails only. More information here (Inbound email actions). For FWD types it creates New cases.
I suggest you to change your inbound action type as "Reply" and sent a test reply type email with watermark. This will surely update the existing record. I'm not sure fwd emails work on this updation of cases or not please test this case.
If your requirement is specific to FWD emails should be updating the ticket. Please refer to the below links which mighty be helpful.
Inbound Email – New, Reply, and Forward
Criteria for matching email to inbound actions
Recognized forward prefixes - glide.email.forward_subject_prefix
If it helps, please mark ✅ Correct and 👍 Helpful.
Thanks & Regards,
Madhav.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2020 03:49 AM
Hi Madhav,
If i reply to the email it does update the case record correctly. I was looking for a way for ServiceNow to update the case record when an email is forwarded.
I was hoping the system would be able to use either the reference number in the subject line or the watermark to find the case record to update and then put the body of the email in to the comments section.
Chris

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-03-2020 04:19 AM
Hi Chris,
I just found out this email property glide.email.reply_subject_prefix . Please refer to Email forwards as replies section in this link Inbound email action processing.
I think changing that property value starting with "fw:,fwd:,Fwd:,FWD:" will classify fwd emails from email clients as reply type in ServiceNow so that reply email actions are triggered and updates the tickets. Also remove fw in glide.email.forward_subject_prefix property.
You can find those settings in Email properties module ->
Look at the bottom replies in this post for reference. https://community.servicenow.com/community?id=community_question&sys_id=6c4fba69db58dbc01dcaf3231f96...
If it helps, please mark ✅ Correct and 👍 Helpful.
Thanks & Regards,
Madhav