
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2020 03:39 PM
I'm trying to make a script but I'm having a hard time. I need to handle the subject of an email that will be received by the Inbound Email trigger, and for this I need to make a script on the conditions part of the Look Up Record action. I believe that GlideRecord should be used, but I would like an example so that I can follow better.
Solved! Go to Solution.
- Labels:
-
flow designer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 11:43 AM
I'm not clear on the question, I think.
Does the example script return the code you're looking for and you are just having a hard time getting the condition to work and select only the appropriate records? if that's the case, I think all you need to do is concatenate that string and return an encoded query instead of the result string in your example, so instead of:
var result = str.match(r);
try:
var result ="descriptionLIKE" +str.match(r);
then you can return the encoded query with your return result; line

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-22-2020 04:48 PM
The email subject can be accessed using email.subject
For example, if you need a condition based on the "UPDATE" being in the subject, you could write the condition like:
email.subject.indexOf("UPDATE") > -1
If you don't care about case, you would do:
email.subject.toLowerCase().indexOf("update") > -1
More info available on Inbound Actions here:
https://docs.servicenow.com/bundle/orlando-servicenow-platform/page/administer/notification/task/t_C...
Accessing email Object variables:

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 08:07 AM
Within the subject of the email comes a code (Example: "Case Created | CS1234567: Problem description"), and I need to filter that code ("CS1234567") to search within the incidents created (that has this code in the description). I can't put this filter under conditions. Following images:
Here is where I need to place the script:
Here is an example of the treatment I need to do on the subject:
I need to do this treatment inside the conditions script, so I can find the right record.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2020 11:43 AM
I'm not clear on the question, I think.
Does the example script return the code you're looking for and you are just having a hard time getting the condition to work and select only the appropriate records? if that's the case, I think all you need to do is concatenate that string and return an encoded query instead of the result string in your example, so instead of:
var result = str.match(r);
try:
var result ="descriptionLIKE" +str.match(r);
then you can return the encoded query with your return result; line