Inbound action is not working

tGhadage
Tera Contributor

Hello Guys, 

 

I have written a script in inbound action where if the subject contains " Escalation: High " and if the mail is coming from for eg.

"tushar.ghadage@test.com" (have changed the mail-Id) then it should create a p2 incidents. 
 
But it's creating an incident for all the subject lines. 
 
Here is the Inbound script:
 if (email.subject.contains("Escalation: High") && email.recipients.toLowerCase().indexOf('tushar.ghadag@test.com') > -1) {
            current.impact = 2;
            current.urgency = 2;
            current.priority = 2;
            current.insert();
        }  
 
Here is the screenshot for incident that it created: 
Screenshot (181).png
Here subject does not contain "Escalation: High" still it created an incident for it.
 
Any help or answer would be really appreciated. 
 
Thank You!!
 
 
 
5 REPLIES 5

Amitoj Wadhera
Kilo Sage

Hi @tGhadage  ,

 

It looks like there might be a misunderstanding with the use of the email.recipients field. The email.recipients field is not the correct field to use for checking the sender of the email. Instead, you should use email.from to check the sender's email address.

 

Here's a corrected version of your script for the inbound email action:

 

if (email.subject.indexOf("Escalation: High") > -1 && email.from.toLowerCase() === 'tushar.ghadage@test.com') {
    current.impact = 2;
    current.urgency = 2;
    current.priority = 2;
    current.insert();
}

 

 

If you find my response helpful, please consider marking it as the 'Accepted Solution' and giving it a 'Helpful' rating. Your feedback not only supports the community but also encourages me to continue providing valuable assistance.

 

Thanks,

Amitoj Wadhera

Hi @Amitoj Wadhera , 

 

Have checked with " .from " also its not working so had gone with this method.

 

Thanks, 

Tushar Ghadage

Yousaf
Giga Sage

Hi @tGhadage
Why dont you use conditions here and than just set values in your script 

Yousaf_0-1716896056733.png


Second Please check if this is your notification that is triggering.
It seems like out of the box notification is triggering in your Screenshot. if that is the case you will have to change the weight so your notification gets triggered first.

Mark Correct and Helpful if it helps.




***Mark Correct or Helpful if it helps.***

Hi @Yousaf , 

 

Have applied condition in those filters to but its not working there. 

 

Thanks, 

Tushar