What is the best way to compare and find common elements between two "Lists" field types referencing the same table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2015 03:52 PM
Right now what I am doing is returning the lists from each different object as a string, parsing them out to two arrays based on the delimiter, then iterating through each array to output the common elements.
I'm just wondering if servicenow has a more straightforward way to do this, that might not have to involve me looping through in this fashion each time I want to find common referenced items between two lists referencing the same table.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-10-2015 09:48 PM
Hi Brian,
The following solution proposed by ctomasi should be of help.
Also... please note the comment on that post which suggests to use diff, intersect, and union when using the ArrayUtil.
Thanks,
Berny
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-11-2015 12:57 AM