Script Include To Filter Module List View Not Being Called

thisisauniqueus
Giga Expert

Hi

I have an issue. I have created a new module called Honey Jars and in the module link type i have selected URL(from arguments). In the arguments i am calling a script include like

find_real_file.png

i have written a script include like

find_real_file.png

now the issue is this script include is not getting called as the event is never logged. Can any one please help me solve this issue. Basically i want to filter the list view based on the logged in user group membership.

The list shows a filter like

find_real_file.png

Regards

1 ACCEPTED SOLUTION

Patrick Schult2
Giga Guru

John, you can indeed do this. The important thing to remember is that the only thing your script include should RETURN is a string for what you want to put into the query.



For example, if your arguments are "u_honey_jars_list.do?sysparm_query=u_contract=javascript:getSomething()&sysparm_view=", then your script include should return a string value of whatever u_contract should be. The way it's written here, with an equals sign after u_contract, you need to return a SINGLE sys_id to it. If you return multiple, it won't work. If you were wanting to return multiple sys_ids to it, return a comma separated string, not an array object.



As proof it will work, see the attached screenshots.


View solution in original post

15 REPLIES 15

anurag92
Kilo Sage

It won't work in this way, URL from argument expects a filter to be returned.



So, sysparm_query=javascript:getSomething() will not call any script include, because there is not filter after query. The correct format would've been:



sysparm_query=assignment_group=javascript:getMyGroups()


Thanks Anurag for your time. I want to filter on a custom field. Is there a way that instead of filtering on assignmnet_group and using the OOTB method of getMyGroups as @Robbie mentioned, i can filter on a custom reference field. That is why i created the scrip include


sorry there were some typos in the screen shot i have removed them. Please have a look



Regards


Robbie
Kilo Patron
Kilo Patron

Hi,


If you're trying to return a list of all 'honey jar' records (u_honey_jar table), I would simply change the following:



Link Type field: List of Records


Add the following Filter Conditions:


Under the -- choose field -- option select 'Active' is true


also choose 'Assignment group' is for the operator and in the reference field use the following out of the box method javascript:getMyGroups()



This will return all records that are active for the logged in user group membership