Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

Using sysparm_query like Reference Qualifier in URL

Alex Winkley
Tera Contributor

This is a similar post to https://www.servicenow.com/community/developer-forum/how-if-possible-to-use-script-include-for-entir...

 

In our use case, we want to control the applied table filter when a module/URL is loaded using one singular function which is coded per role. Using a simple example:

 

 

var clientUtilV1 = Class.create();
clientUtilV1.prototype = Object.extendsObject(AbstractAjaxProcessor, {
    test1: function() {
		return 'a83820b58f723300e7e16c7827bdeed2';
    },
    test2: function(){
		return 'sys_id=a83820b58f723300e7e16c7827bdeed2';
    },
    type: 'clientUtilV1'
});

 

 

If I were to go to link 1 below, the query works as intended and returns the record with sys_id=a83820b58f723300e7e16c7827bdeed2

Link 1: https://dev200523.service-now.com/incident_list.do?sysparm_query=sys_id=javascript: new global... 

(because the link gets cut off, sysparm_query uses javascript: new global.clientUtilV1().test1(); 

However, if I use the link 2 below, the query returns all records and ignores the javascript call

Link 2: https://dev200523.service-now.com/incident_list.do?sysparm_query=javascript:new global.clientU... 

(because the link gets cut off, sysparm_query uses javascript: new global.clientUtilV1().test2(); 

 

The function call in Link 2 drops the field in the effort of passing an entire encoded query, rather than the target value(s) for a specific field. This syntax is commonly used for Reference Qualifiers where you want to pass an entire encoded query. My question is this - is there a way to apply this Reference Qualifier like filter to sysparm_query (or another sysparm type parameter?) rather than having to do an individual script include per field? I ask because some user groups need the filter based on fields a/b/c, but other user groups need it based on fields d/e/f. For reasons I won't get into, this ideally needs to be driven all from the same URL.

 

Thanks!

0 REPLIES 0