Filter table using field another table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 08:49 AM
Hello team,
I am trying to create a filter condition that will display the table entries only in case the incident number is different from the number stored in a field of another table.
smth like this:
Notice: I have added to the main table (the one I am filtering) a field that is referencing to the other table (the one containing the filed that should not match the incident number) so that I could dot walking in the filter.
When I run such filter, I get nothing
Is there a way, probably via script, to create this condition?
Thanks a lot and sorry the silly questions
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 09:36 AM
I wonder if you just need to dot walk a bit further to ...INC Number --> Incident fields --> Number to make sure that you're comparing the number with another number (and not a sys_id).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-15-2017 12:49 PM
Seems like you should be able to do this with a Script Include. Script includes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 01:50 AM
Hey,
Thank you so much for the replies. Yes I will try to do that via Script include.
If I may, I have another question, I use a System UI policy with Script to modify the fields within a form, I can do this perfectly when the fields belong to the specific table, but I am unable to do that if the field is related to a different table (even if present in the form via dot walking).
ex.:
g_form.getValue('u_reviewed')
Where u_reviewed is field of the incident table which is present in the form of the table I am working with via dot walking.
If I use that simply script I don't get the value of that column (as I guess it is part of the other table)
I thought of using
var inc = new GlideRecord('incident');
to get direct access to the incident table but then I cannot use the option for get the displayed value.
Sorry again the silly question, I am learning
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-16-2017 05:24 AM
You can't update another table without doing a GlideRecord query like you had said.
See here: http://wiki.servicenow.com/index.php?title=Using_GlideRecord_to_Query_Tables#gsc.tab=0
To get the Display Value, see here: http://wiki.servicenow.com/index.php?title=GlideRecord#getDisplayValue