Can you change the reference qualifier on a field using a client script?

PranavSuj96
Mega Expert

Hello all.

 

I need to change a reference qualifier so that the refence shows all the applications from the application table on a catalog task in my workflow. Currently it is only showing the applications which are related which I filtered on the form display.

 

Any way I can do this? I can even call my script include with an empty parameter so it returns all the values but it doesn't matter if it is not using a reference qualifier.

 

Help would be greatly appreciated!

4 REPLIES 4

sachin_namjoshi
Kilo Patron
Kilo Patron

Please see solution below

 

https://community.servicenow.com/community?id=community_question&sys_id=fa338be1dbd8dbc01dcaf3231f961923

 

Regards,

SAchin

hey Sachin,

 

I checked this out.

 

This is the code I currently have in an if statement in my workflow. The portion in the if statement is not working as intended.

 

answer = new findApps().checkRelationship(current.variables.ref_ci, current.variables.ref_app);
if(!current.variable.ref_app)
{
current.variables.ref_app = new findApps().findAppsInRelationship("");
}

 

According to the post you linked just adding a javascript: would fix this?

Thanks, Pranav.

Also as an addendum, the reason my case differs is because this is after submit of the form. I am able to use an advanced reference qualifier when the user is still submitting the form.

 

Any ideas?

alexaria
Tera Contributor

this article worked for me:
How to modify Reference Qualifiers with Catalog Client Scripts – ServiceNow – ServiceNow Think (word...

 

 

and this is the onChange client script:

 

var resetFilter = 'active=true^nameISNOTEMPTY^emailISNOTEMPTY^EQ';
var dynamicFilter = g_form.getValue('your other text var holding encoded query').toString().trim();
var gg = g_list.get('your ref var name'); // GlideList2 object
gg.setQuery(newValue == '' ? resetFilter : dynamicFilter);