- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2022 08:18 AM
I am currently trying to create an advanced reference qualifier on record producer to have a dynamic user list show up when a certain record is referenced on the form.
When an event (record) is referenced on the form, each record contains a list of users. On an event record, there is a list type field (referenced to sys_user table) that contains users. (field name is u_poi)
The ask is only show the list of users for the referenced record on the form.
Picture below:
For example:
1. If the event contains multiple users, the person of interest reference should only show the list of users on the event record.
I have tried creating a script include but no luck as of yet.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:53 AM
I figured out a solution. I created a script include and used the event record sysID as a parameter. Below is my script that worked:
getQuery: function(event) {
var gr = new GlideRecord("u_metric_example");
gr.get(event);
var users = gr.watch_list.toString().split(",");
var q = new GlideRecord("sys_user");
q.addQuery("sys_id", users);
q.query();
var filter = q.getEncodedQuery();
return filter;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:28 AM - edited 01-05-2023 11:29 AM
try replacing your semi-colon with a colon and it looks like you've got an '=' after the IN. Try this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:53 AM
I figured out a solution. I created a script include and used the event record sysID as a parameter. Below is my script that worked:
getQuery: function(event) {
var gr = new GlideRecord("u_metric_example");
gr.get(event);
var users = gr.watch_list.toString().split(",");
var q = new GlideRecord("sys_user");
q.addQuery("sys_id", users);
q.query();
var filter = q.getEncodedQuery();
return filter;
},
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 11:54 AM
Here was my reference qualifier:
javascript:new MetricUtils().getQuery(current.variables.int_event);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 12:01 PM
Good deal. FYI, the issue w/ your first approach is the equal sign after IN:
'sys_idIN='+current.variables.int_event.watch_list
It's prefixing that to the first string of the array. Removing that would have worked as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2023 12:25 PM
TCole94,
Watch out for syntax errors...you have = signs all over the place. There's one after sys_idIN on a previous post and before current.variables more recently...that one should be a comma.