Inbound action condition to skip creating incident

oharel
Kilo Sage

Hi all,

This might be a bit basic, but I can't get it to work:

I am trying to tell the inbound action to skip creating an incident if the body of the email contains the word "CLEARED: ".

I am trying something like this:

...

} else if (email.recipients.indexOf('monitoring.network@MyCompany.com') > -1) {

  if(email.body.indexOf("CLEARED: ") > -1) {

  current.setAbortAction(true);

  }

  createIncidentNetwork();

  gs.log('HBS, createNetworkIncident');

}

Using if(!email.body.indexOf("CLEARED: ") > -1) yields: confusing use of !

How do I tell the script to stop running?

How do I fix this if condition?

Thanks,

Harel

1 ACCEPTED SOLUTION

dwolf
Giga Expert

Hi,



I would try adding an email filter instead of using the inbound action.



The Email Filter plugin must be activated to work.


Create a new Filter and add the condition "Body contains cleared: "


Under filter actions you can mark is as ignored or junk (for testing I use junk)



Hope this helped.


Darla


View solution in original post

10 REPLIES 10

Hi Darlene,



I am trying this now. Thanks!


Although the plugin is quite an elegant solution, I'd still want to try and work it out with a script, though.


Harel