How to write a script for inbound email action if subject contains 3 key words like xyz, abc & pqr ?

ads
Tera Expert

Hi All,

I have to write a script for inbound email action if subject contains 3 key words like xyz, abc & pqr then the ticket will assign to the particular group. Can anyone please let me know how to do this ?

 

 

Thanks

 

1 ACCEPTED SOLUTION

Hi,

Yes, that will work. One suggestion would be to convert the subject to lowercase, just incase they use ABC instead of abc...with your current script, it would miss that.

email.subject.toLowerCase().indexOf('abc') > -1 would be better.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

7 REPLIES 7

Allen Andreas
Administrator
Administrator

Hi,

You can use a flow (flow designer) inbound email trigger for this with the condition that the subject contains xyz or subject contains abc, etc.

Then use an update record action to set the assignment group as needed.

Try that? That method helps avoid scripting and such.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi @Allen Andreas,

We are not using the flow disigner currently, I will try as per your suggestion, however can you please let me know if the below script is correct or not?

 

if(email.subject.indexOf("xyz")>-1 || email.subject.indexOf("abc")>-1 || email.subject.indexOf("pqr")>-1)

Hi,

Yes, that will work. One suggestion would be to convert the subject to lowercase, just incase they use ABC instead of abc...with your current script, it would miss that.

email.subject.toLowerCase().indexOf('abc') > -1 would be better.


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi @ads 

Let me know if you have any other questions

If my reply above helped guide you Correctly, please also mark my reply as "Accept Solution".

Thanks and take care! 🙂


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!