Set query on a variable post submission of a requested item

Tracy5
Tera Contributor

Hi,

 

We have variables which should not be displayed on Catalog form, but should be mandatory on Catalog Task.

These reference type variables need to have their query set onLoad and onChange of a Catalog Task.

 

I'm getting the query successfully via Ajax call using Catalog Client Script and Script Include, but I'm unsure how to get it applied on the variables.

 

I've tried below and both were unsuccessful:

 

var variableName = "abc";
var queries = JSON.parse(response);
var queryString = "sys_idIN" + queries.filter;
 
1.
var variable = g_list.get(variableName);
client.setQuery(queryString);
 
2.
window[variableName + 'g_filter'].reset();
window[variableName + 'g_filter'].setQuery(queryString);
window[variableName + 'acRequest'](null);
 
How would I be able to set the query on these variables?
1 ACCEPTED SOLUTION

dgarad
Giga Sage

Hi @Tracy5 

 

Script Include returns reference qualifier string e.g. "sys_idINx,y,z".

On the reference field, Type Specifications > Use reference qualifier > Advanced.

In the Reference qual field: 

 

javascript: new ScriptIncludeName().FunctionName();

Example:

 

javascript: new PositionUtils().getPeopleLeaderUsersRefQual();

Note: Replace : with an actual colon.

If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad

View solution in original post

3 REPLIES 3

Community Alums
Not applicable

Hi @Tracy5 ,

 

There is no need of client script to restrict reference table data.

 

You can add reference qualifier on reference catalog variable. 

Sai149_0-1716361762988.png

 

You can even call the script include from the variable. You can write the logic in your script include so that it will return comma separated sys id's of the groups.

Sai149_1-1716361937899.png

 

I started answering community questions recently. If my answer helped you in any way, please mark it as helpful or correct. It would be a great boost.

dgarad
Giga Sage

Hi @Tracy5 

 

Script Include returns reference qualifier string e.g. "sys_idINx,y,z".

On the reference field, Type Specifications > Use reference qualifier > Advanced.

In the Reference qual field: 

 

javascript: new ScriptIncludeName().FunctionName();

Example:

 

javascript: new PositionUtils().getPeopleLeaderUsersRefQual();

Note: Replace : with an actual colon.

If my answer finds you well, helpful, and related to the question asked. Please mark it as correct and helpful.

Thanks
dgarad

Yep this works, just need to ensure that the script include is callable by the client