Change the reference quaifier on a list collector via catalog client script

johnfeist
Mega Sage
Mega Sage

I have a list collector that needs to change the qualifier based on input to other fields.  I have it working correctly in the portal view via the following:

var theCompany = g_form.getValue("company");
var theType = g_form.getValue("type_of_access");
var thePair = theCompany + "-" + theType;
var theFilter = "u_item=673e47cd1b3e3990118ccbb4604bcbaa^u_variable=role_s^u_value_1=" + thePair;
var theList = g_list.get("role_t");
theList.reset();
theList.setQuery(theFilter);

One of the steps in fulfillment is that the request needs to be reviewed and possibly have changes made.  I have the changes part running fine.  Unfortunately when a fulfiller opens the item they get errors around g_list.  I've tried all sorts of different approaches without success.  Any suggestions as to how I can get this working for the fulfiller?

 

Hope that helps.

:{)

Helpful and Correct tags are appreciated and help others to find information faster
2 REPLIES 2

-O-
Kilo Patron
Kilo Patron

g_list is not an "gateway" to List Collector variables; it is used on forms to mange related (and/or embedded) lists.

I don't even think it is defined in Portal.

I know that when the dinosaurs roamed the earth, Lists Collectors did not support reference qualifiers like other fields did and one could set it only on client side - in CMS.

But that is no longer the case, List Collectors support plain regular reference qualifiers which work server side and you should use it like that.

In that server script that would serve as the encoded query builder, you will have access to all other variables, just as if it were on client side - there is no reason why to even think of making it a client side thingy.

Plus - as already stated - it just does not/no longer work client side.

alexaria
Tera Contributor

this helped me to remove the error.

 

function isBackend() {
    return typeof g_sc_form != "undefined";
}
 
if (!isBackend()) { // backend will also keep the frontend submited filter/query
    // you rg_list code here
}