How to do a "vlookup" in javascript
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 05:51 AM
Hi all,
I want to do sort of a "vlookup" in ServiceNow with a scheduled script execution.
- Column_A is in table "u_test" and is a reference field
- Value "X" is a value in Column_A and belongs to reference table "u_example"
- If Column_A has the value "X" and value "X" is in reference table "u_example", then return the name of reference table "u_example" into another column called "Column_reference"
- I want this to be dynamic so I do not want to simply call the value out specifically, rather look to see if the value of records in column_A reside in u_example reference table and if so, put the name of the reference table into "Column_reference"
Any help with this would be greatly appreciated!
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 06:38 AM
My first thought is why do you need to do this? What is the value you gain from it.
Second item is that if you just want to see the referenced table in a list you can configure the list layout and just dot walk the field to its referencing table and put either the class field or the task type field on the list.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-16-2020 08:15 AM
Hi Drew,
I am wanting to do this for reporting purposes in a dashboard. Currently the records in my table cannot be filtered on in a dashboard view effectively. This would solve that problem.
My custom column that I want to report off of is not a reference field, I simply want to run a scheduled job that creates this custom column view for reporting purposes.
Regardless, thanks for taking the time to respond!