Forward Inbound actions

mohna
Kilo Contributor

Hi All,

My requirement for inbound action -Type:Forward, it should update the previously created HR case through inbound email action.

in when to run,below one given

find_real_file.png

condition as email.origemail.indexOf("myinstnace@service-now.com")==-1

actions:

find_real_file.png

gs.include('validators');

if (current.getTableName() == "sn_hr_core_case") {
current.comments = "forwarded by: " + email.origemail + "\n\n" + email.body_text;
current.work_notes = "forwarded by: " + email.origemail + "\n\n" + email.body_text;
current.update();
}

 

The instance is receiving my fw email, but its not updating teh case created through my first email to instance(new type alos configured).

 

Please let me know what do i have to check in this.

9 REPLIES 9

One option would be to add FW: as a reply prefix in your email properties, that way they'll be processed in the same way as replies.

mohna
Kilo Contributor

I have added FW in glide.email.forward_from_prefix property.

Not sure what that property is for tbh, try adding it in the glide.email.reply_subject_prefix property.

Ok, maybe this can help you with further troubleshooting : Troubleshooting inbound email action issues

mohna
Kilo Contributor

I have updated my script to get number from subject of email. Now i am able to update the through this forward inbound action.

However, I see one more case created .which means the case in the subject is getting updated(which satisfies my requirement)

I do not want a new case to be created through this forward inbound action.Below is the code i use in actions.

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

// Implement email action here
gs.include('validators');
if (current.getTableName() == "sn_hr_core_case")
{
var index = email.subject.indexOf("HRC");
var incNumber = email.subject.substring(index,index+10);
gs.info(incNumber +' test ');
var gr = new GlideRecord('sn_hr_core_case');
gr.addQuery('number',incNumber);
gr.query();
while(gr.next())
{
gs.info('num '+gr.number);
gr.description = email.body_text;
gr.work_notes = "forwarded from: " + email.origemail + "\n\n" + email.body_text;
gr.comments = "received from: "+email.origemail +"\n\n" +email.body_text;
gr.update();
}
}

})(current, event, email, logger, classifier);

 

I see in the email logs, that new case is created through workflow. (see below screenshot). I donot want that one to be triggered.

find_real_file.png

 

Please provide your feedback as I'm stuck in this .