StandardChangeTemplate API not using sysparm_query causes search to return all templates even passing an encoded query


Standard Change Template REST end point: Template - search (GET) returns all templates even though passed an encoded query.

Steps to Reproduce

1. Go to REST API Explorer
2. Choose sn_chg_rest,
3. Template - search (GET)
4. Add query parameter: sysparm_query
5. Add an encoded query e.g. category=651395bc53231300e321ddeeff7b1221


This problem is fixed in all currently supported releases. Review the Fixed In section to determine the latest version with a permanent fix your instance can be upgraded to.

The pre-Orlando workaround consisted in modifying the Script Include StandardChangeTemplate (266cb918b713130096c3e4f6ee11a91e), replacing the line:

StandardChangeTemplate.findAll = StandardChangeTemplateSNC.findAll;


StandardChangeTemplate.findAll = function(orderBy, textSearch, encodedQuery) {
	orderBy = orderBy || ChangeProcess.NAME;

	var changeRecordProducerGr = new GlideRecordSecure(StandardChangeTemplateSNC.CHANGE_RECORD_PRODUCER);
	changeRecordProducerGr.addQuery("retired", false);
	if (textSearch !== undefined && textSearch !== "undefined" && textSearch.trim() !== "")
		changeRecordProducerGr.addQuery("", "CONTAINS", textSearch).addOrCondition("template.short_description", "CONTAINS", textSearch);

	if (encodedQuery !== undefined && encodedQuery !== "undefined" && encodedQuery.trim() !== "")

	return changeRecordProducerGr;

Related Problem: PRB1351344