How to add Reference Qualifier to Record Producer Variable

Christine30
Tera Guru

Hello:

I have a script include which returns a list of Product Model (cmdb_model) sys_ids, and an associated dynamic filter.  I am able to use the dynamic filter to filter a List View.  I've attached the script include and related screenshots.

Now, I would like to use the same dynamic filter on a record producer variable which is a reference to the Product Model table,  but am unable to do this.  No dynamic filters are available for the record producer variable (see first screen shot below). 

I've tried to use this advanced reference filter instead of a dynamic filter :  "javascript: new getNameFromCategoryNew().getName("Laptops")", also with no success. 

I would also like to change the "hard-coded" "Laptops" argument to be the category selected by the user, and held in another record producer variable named model_category.  I have tried "javascript: new getNameFromCategoryNew().getName(producer.model_category)", but the value does not seem to be passed to the script include. 

Thank you for any help.

 

find_real_file.png

 

1 ACCEPTED SOLUTION

Willem
Giga Sage
Giga Sage

Do you have the logs in the Script include? What do they log when you use this?:

javascript: new global.getNameFromCategoryNew().getName(current.variables.model_category.getDisplayValue());

 

Make sure there are no other variables or variable set named model_category. And change global to the scope your script include is in, for example:

javascript: new scopeapp.getNameFromCategoryNew().getName(current.variables.model_category.getDisplayValue());

View solution in original post

20 REPLIES 20

I hadn't moved the script include to the global scope. I did and it worked when I 'hard coded' laptops in the advanced ref qualifier, thanks!: 

javascript: new getNameFromCategoryNew().getName("Laptops")

When I use this and select "Laptops" for model_category, I now get no records returned, which isn't right, but is an improvement:

javascript: new getNameFromCategoryNew().getName(current.varialbes.model_category)

Ok nice! And with the displayValue? because "Laptops" looks to me like a displayValue.

Adding getDisplayValue didn't work, but that is on the right track, because when I changed the model_category variable to be a string and typed in "Laptops" it worked.  

Below worked.  And it worked with variables within a variable set as well.  Thank you for spending time on this!!

javascript: new getNameFromCategoryGlobal().getName(current.variables.model_category.name.toString())

You are very welcome! Appreciate you marked answer as Correct! 🙂

Also feel free to mark additional answers helpful if they are.

Have a great week!