Dynamic Reference Qualifier

keviningleby
Tera Expert

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)

script-include.jpg

My Dynamic Filter

dynamic filter.jpg

My Dictionary entry

dictionary.jpg

I have tried lots of permutations but nothing seems to work

Any clues, hints, tips would be most welcome

Best Regards

Kevin

1 ACCEPTED SOLUTION

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



Screen Shot 2017-04-05 at 11.20.24 AM.png


View solution in original post

26 REPLIES 26

Chuck Tomasi
Tera Patron

Hi Kevin,



The first thing that jumps out at me is your push() call. Try this instead:



services.push(gs.getValue('sys_id'));



GlideRecord is a pointer so it's going to copy a reference. Using getValue() ensures you get the value of each record COPIED in to the array rather than the reference.


Uncle Rob
Kilo Patron

You're in Global scope so you still have access to gs.log.   First thing I'd do is pop a gs.log into your script include to see if you're even getting that far.


keviningleby
Tera Expert

Chuck,



I thought I would need an array of Refs returned - not Strings ?



Robert,



No output from gs.log in the System Log



Looks like nothing triggers when I click the Service search button .....


mamann
Mega Guru

The script field on your Dynamic Filter is only calling the class, but not the method that's returning the data you want.



Try changing it to the following, new kevGetServicesForCompany().mykevGetServicesForCompany();