Inbound Action Condition to call Script Include function

SNowUser11
Kilo Guru

Hi Experts,

I want to add extra condition to check in my inbound action whether the email subject contains INCIDENT or not . There are many places where I need to check this so thought of putting it in script include and calling it in condition but it is not executing SI . SI has prototype. 

Want to execute when email subject does not contains any INCIDENT

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Kieran Anson
Kilo Patron

Hi,

Have you validated that the SI is being called?

Also your script is incorrect. you're passing email.subject as the email variable however you're then doing:

var str = email.subject.toString();

This is effectively

var str = email.subject.subject.toString();

 

change it to var str = email.toString();

View solution in original post

14 REPLIES 14

Its client callable and the subject of email contains INC so have put email.subject.xx

Kieran Anson
Kilo Patron

Hi,

Have you validated that the SI is being called?

Also your script is incorrect. you're passing email.subject as the email variable however you're then doing:

var str = email.subject.toString();

This is effectively

var str = email.subject.subject.toString();

 

change it to var str = email.toString();

Aah! yes makes sense . Working with

var str = email.toString();

Thanks for pointing out the logic

Also the SI returns true OR False and how do I get the 'incnum' (Incident number) in inbound actions calling this SI in inbound actions

You could add a new function to your script include or write the following in your inbound action: 

regex = new SNC.Regex('/INC\\d{7}/im');
var a = regex.match(email.subject.toString())[0];