- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 12:51 AM
HI Community,
Can you please enlighten me what exactly is mentioned here:
This is the condition for inbound email action to create an incident
new global.KAL_Inbound_Actions().validSender(email.recipients.toLowerCase())||email.recipients.indexOf(gs.getProperty('instance_name')+'@service-now.com') > -1
in this i can see KAL_Inbound_Actions in script include and validSender is function but i don't understand the rest
script include:
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 01:10 AM
Condition:
global.KAL_Inbound_Actions().validSender(email.recipients.toLowerCase())||email.recipients.indexOf(gs.getProperty('instance_name')+'@service-now.com') > -1
1. global.KAL_Inbound_Actions().validSender(email.recipients.toLowerCase()) -> This will check if the sender emai id is part of the email list or not. Here we are passing the sender email to the script include function.
2. email.recipients.indexOf(gs.getProperty('instance_name')+'@service-now.com') > -1 -> This will chcek if the sender email id is matching with the intance email id. Here we are fetching the instanace id from the system property gs.getProperty('instance_name').
If either Condition 1 or Condition 2 is satisfied, the email will be processed; otherwise, it will be skipped.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 12:55 AM
Hi @suuriyas
I believe comma-separated email IDs are stored in the system property itsm.email. The system checks whether the sender's email ID is included in the list stored in this property. If it is, the script returns true.
Regards,
Siva
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 01:00 AM
HI @J Siva ,
Thanks for the response
Yes in property we have comma-separated email IDs are stored. yes script returns true but can you please explain the condition mentioned in inbound action.
new global.KAL_Inbound_Actions().validSender(email.recipients.toLowerCase())||email.recipients.indexOf(gs.getProperty('instance_name')+'@service-now.com') > -1
im not getting it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 01:06 AM
var itsmEmails = gs.getProperty("itsm.email").toLowerCase().split(',');: This line retrieves a property named itsm.email using the gs.getProperty method (likely a ServiceNow global object function) and converts it to lowercase. It then splits the string into an array of email addresses using the comma as a delimiter.
for(var i=0; i<itsmEmails.length; i++): A for loop is initiated to iterate over each email in the itsmEmails array.
Inside the loop, the code checks if validEmail is true. If it is, the loop breaks early, meaning a valid email has already been found.
If validEmail is false, it checks if the current itsmEmails[i] is present in the recepients string using recepients.indexOf(itsmEmails[i]) > -1. The indexOf method returns the position of the first occurrence of a specified value within a string, or -1 if it is not found.
If the email is found in recepients, validEmail is set to true, indicating a valid email was found. The commented-out line //gs.log('xxxRavs '+itsmEmails[i]); suggests that there might have been a logging statement for debugging purposes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-19-2025 01:10 AM
Condition:
global.KAL_Inbound_Actions().validSender(email.recipients.toLowerCase())||email.recipients.indexOf(gs.getProperty('instance_name')+'@service-now.com') > -1
1. global.KAL_Inbound_Actions().validSender(email.recipients.toLowerCase()) -> This will check if the sender emai id is part of the email list or not. Here we are passing the sender email to the script include function.
2. email.recipients.indexOf(gs.getProperty('instance_name')+'@service-now.com') > -1 -> This will chcek if the sender email id is matching with the intance email id. Here we are fetching the instanace id from the system property gs.getProperty('instance_name').
If either Condition 1 or Condition 2 is satisfied, the email will be processed; otherwise, it will be skipped.