Filter table using field another table

gabriel_sk
Tera Contributor

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:find_real_file.png

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

5 REPLIES 5

Nia McCash
Mega Sage
Mega Sage

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).


Shane J
Tera Guru

Seems like you should be able to do this with a Script Include.     Script includes


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


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