- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 07:18 AM
I am trying to create a Dynamic Reference Qualifier and not having much luck.
(Personal development instance - Helsinki latest patch)
The objective is - on a Task Form - e.g. Incident -
select a "Company" value -
and then use a dynamic filter on the "Business Service" search pop-up to restrict choices to only those services that have their company attribute set to the same value.
My Script Include: (as you can see - I tried various ways to get the company value)
My Dynamic Filter
My Dictionary entry
I have tried lots of permutations but nothing seems to work
Any clues, hints, tips would be most welcome
Best Regards
Kevin
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 09:23 AM
Actually.. if you're just trying to filter based on the current company, you don't have to run a lookup script at all.
In your dynamic qualifer, you can just have this one line:
return "company=" + current.company;
When this is the case, I prefer to simplify the whole thing and use an "advanced" reference qualifier instead of dynamic:
javascript:"company=" + current.company
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:00 PM
Hi Kevin,
I used you threat for my own needs which is very similar. the below works for me but not doing what I need yet that aside, the gs.log does work and it prints sys id to the log for each BS it finds.
You can use the below maybe to test change Function name to yours and double check on the field name in my instance on cmdb_ci_service company field is named u_company
BusinessServices : function()
var gr = new GlideRecord('cmdb_ci_service');
gr.addQuery('u_company, current.company');
//gr.addEncodedQuery('u_companyLIKE'+current.company);
gr.query();
var services=[];
while (gr.next()){
services.push(gr.sys_id + '');
gs.log('found: ' + gr.sys_id.toString());
}
return "sys_idIN" + services.join(",");
},
Hope it helps.
Ellie

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:30 PM
gr.addQuery('u_company, current.company'); is invalid.
Use gr.addQuery('u_company', current.company);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:08 PM
Just had another look at your original screen shot did you uncomment your gs.log line when running the code? In the screen shot I see //
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-06-2017 12:15 AM
Yes.
It now seems that the script was bombing out before the log statement. (See below)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-05-2017 12:32 PM
If your "company" field is a GlideList type, you need to change your .addQuery() line to
gr.addQuery("company", "CONTAINS", current.company)
or
gr.addQuery("company", "LIKE", current.company)