List Collector dynamic reference qualifier for catalog item

Michael M1
Giga Expert

I have a list collector variable on the sys_user table in a catalog item and I want to update the filter on the collector based on a selection of a drop down on the catalog item. I can do this as a catalog client script but I am having trouble setting the encoded query.

I want to encode 2 things

- show only users whose manager is the current user (i.e. requestor).

- The requestor chooses expires in 30, 60, or 90 days from a drop down list. I need to show users that have u_expires date field less than 30/60/90 days from now.

Thanks

1 ACCEPTED SOLUTION

Jim Coyne
Kilo Patron

OK, actually, we should be able to accomplish this without a Client Script:

1. set the Reference qualifier for the List Collector to the following:

javascript:"active=true^u_user_type=Consultant^manager=" + gs.getUserID() + "^u_expiresRELATIVELT@dayofweek@ahead@" + current.variables.number_of_days;

2. set the "Variable attributes" field for the List Collector to the following:

ref_qual_elements=number_of_days

The "ref_qual_elements" attribute will send back to the server the current values for those variables so they can be used in the reference qualifier.

Replace "number_of_days" in both the Reference qualifier and the "Variable attributes" field with whatever your variable name is.

I tried it in my dev instance with "Company" and "Users" variables and the Users list collector changes based on the selected company.  In both the regular and portal UIs.

View solution in original post

11 REPLIES 11

SatheeshKumar
Kilo Sage

you can combine both the conditions in a single encoded query, can you post the encoded query you have tried, we can try to modify that to fix your issue

 

-Satheesh

The query so far is:

u_user_type=Consultant^active=true^managerDYNAMIC90d1921e5f510100a9ad2572f2b477fe

However, the manager in the interface says: Manager (is dynamic) Me.

That is the sysid you see.

I want the sysid to be the requestor/current user.

Also, I do not see a way to add u_expires < 90 days from today.

Alikutty A
Tera Sage

Can you please check if this query works for you?

 

'u_user_type=Consultant^active=true^manager='+current.variables.requester+'^u_expiresRELATIVELE@dayofweek@ago@'+current.variables.expire_days;

//current.variables.requester is your requester variable name
//expire_days is your days variable and should return 30,60 or 90

//You can also try this once
'u_user_type=Consultant^active=true^manager='+current.variables.requester+'^u_expiresRELATIVELE@dayofweek@ago@30';

Your filter worked although I changed it a bit by defining the variable reference qualifier as such:

active=true^u_user_type=Consultant^manager=javascript:gs.getUserID();

 

However the final piece is to update the filter based on a choice on the catalog form.

There is a button to choose '30 days', '60 days', '90 days' (in the future). That is the label, the Values are 30,60,90.

So I want to create a client script onChange for that variable that will add to the list collector query above to u_expiresRELATIVELT@dayofweek@ahead@30.  (for example)

So can you add onto a ref qualifier that is already built by default?