- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 04:06 AM
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
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 04:18 AM
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();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 01:49 AM
Hi Anson,
Already the SI has the function which is getting the incident (incnum) in my original question snap shot but sorry did not get do i need another separate function ? coz i just need the value which is in variable incnum
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 01:58 AM
Did you use this line in your function and returned the variable a?
var a = regex.match(email.subject.toString())[0];

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2020 02:04 AM
You will need a separate function as your current one is only setup to return true or null.
Or you can modify the existing function to:
checkEmailSubjectForIncident: function(email){
var regex = new SNC.Regex('/INC\\d{7}/im');
var incnum = regex.match(email.toString());
if(incnum[0]){
return incnum[0];
}
}
As this returns a value (truthy) it'll work for the condition and within your script.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-13-2024 05:46 AM
how to validate if script include is being called by the inbound action? how to check if the parameter is being passed to the script include?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-08-2020 04:58 AM
Hi,
Add logs in your Script include to check if the code is getting there.
Add multiple logs to see till where the code is getting and at which point is it failing. RegEx is always a slippery slope
-Anurag