Inbound Email Action not working

amacqueen
Mega Guru

In a new application I have created I have enabled email sending and am showing sent/received email in activities however whilst I can see outbound email I cannot see inbound so I checked 'System Mailboxes - Received' and saw it wasn't being processed. My inbound action on the correct table is as below:-

gs.include('validators');

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

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

  if (email.body.priority != undefined && isNumeric(email.body.priority))

  current.priority = email.body.priority;

  }

  current.update();

}

find_real_file.png

Above is the inbound action

TIA

17 REPLIES 17

Chuck Tomasi
Tera Patron

Hi Angus,



Have you checked out this series of videos? It includes one on debugging. Inbound Email - YouTube


Thanks for the input I had already checked those out but they didn't help at all I'm afraid.



I have played around with this too much now, below is my latest business rule set in the inbound action - I just can't work out why it doesn't process #frustrated:-



gs.include('validators');



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


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



if (email.body.assign != undefined)


current.assigned_to = email.body.assign;



if (email.body.priority != undefined && isNumeric(email.body.priority))


current.priority = email.body.priority;



if (email.body.category != undefined)


current.category = email.body.category;



if (email.body.short_description != undefined)


current.short_description = email.body.short_description;



current.update();


}



I've also checked the new table doesn't extend any other table just to be sure


What does the actual email look like? I noticed that you selected: type = reply. In my experience, the default ServiceNow reply prefixes do not match actual enterprise mail client's reply prefixes (Outlook, Google, etc.).



http://wiki.servicenow.com/?title=Inbound_Email_Actions#Specifying_Recognized_Reply_Prefixes


Robert I checked the reply and it was prefixed with RE so I double checked the system property glide.email.reply_subject_prefix and it already had re so just to double check I added RE and I also added to the inbound action it now has a new second line:-



gs.include('validators');


email.subject.startsWith("RE:")


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


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


if (email.body.assign != undefined)


current.assigned_to = email.body.assign;


if (email.body.priority != undefined && isNumeric(email.body.priority))


current.priority = email.body.priority;


if (email.body.category != undefined)


current.category = email.body.category;


if (email.body.short_description != undefined)


current.short_description = email.body.short_description;


current.update();


}



Interestingly I have noticed that on the received email the target field is empty - see below



find_real_file.png



Does a table have to be registered somewhere for this to work? If so I can't find anything in the WIKI/Product documentation



Thanks