sysparm_fixed_query is not working in UI Action

jordimsant
Kilo Sage

I have created the following UI Action:

var fUtil = new FacturacioUtils();
var tasquesFacturades = fUtil.tasquesFacturades(current.projecte.toString());
var query = 'top_task=' + current.projecte + '^sys_idNOT%20IN' + tasquesFacturades.join(',');

var url = gs.getProperty('glide.servlet.uri') + `sys_m2m_template.do
?sysparm_fixed_query=` + query + `
&sysparm_m2m_ref=x_tntsl_tmn_factur_facturacio_m2m
&sysparm_collectionID=` + current.sys_id + `
&sysparm_collection=x_tntsl_tmn_factur_factures
&sysparm_collection_key=x_tntsl_tmn_factur_factures
&sysparm_collection_related_file=planned_task
&sysparm_collection_related_field=planned_task
&sysparm_stack=no `;

action.setRedirectURL(url);

Nonetheless, when I launch this UI Action the filter does not apply. I am sure query is generating right because if I change "sysparm_fixed_query" by "sysparm_query" it works fine, and I cannot create a before query BR because the tables I am using are in scope application. Does anybody know why "sysparm_fixed_query" is not working? Do you know how to fix it?

 

Thanks in advance!

7 REPLIES 7

Ankur Bawiskar
Tera Patron
Tera Patron

@jordimsant 

I suspect sysparm_fixed_query works well only when it's used in left nav module and not via redirection.

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@jordimsant 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

@jordimsant 

Hope you are doing good.

Did my reply answer your question?

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader