Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Equals sign not being recognized in scripted URL

chrisshellhamme
Tera Expert

I have a scripted URL as the following:

 

var url = window.location.host + '/rm_story_list.do?sysparm_query=cmdb_ci=' + grTS.cmdb_ci_service + '^active=true';
window.open(url, '_blank', 'width=800,height=600');
 
The window is opening without the second equals sign:
 
/rm_story_list.do?sysparm_query=cmdb_ci%3Df6d8ba836f0ee2006a17d5267b3ee4cb%5Eactive%3Dtrue
 
Anyone have any thoughts as to why the second one is being omitted?
1 ACCEPTED SOLUTION

Sheldon  Swift
ServiceNow Employee
ServiceNow Employee

Hi @chrisshellhamme - Try like this:

 

var service = grTS.getValue('cmdb_ci_service');

var baseUrl = window.location.protocol + '//' + window.location.host + '/rm_story_list.do?sysparm_query=';
var query = 'cmdb_ci=' + encodeURIComponent(service) + '^active=true';
var url = baseUrl + encodeURIComponent(query);

window.open(url, '_blank', 'width=800,height=600');

View solution in original post

7 REPLIES 7

Jake Sadler
Kilo Sage

@chrisshellhamme, try using %3D to replace = when adding queries.

 

/rm_story_list.do?sysparm_query=cmdb_ci%3D' + grTS.cmdb_ci_service + '^active%3Dtrue';

 

 

@Jake Sadler thanks for your reply.

 

It renders exactly the same:

 

/rm_story_list.do?sysparm_query=cmdb_ci%3Df6d8ba836f0ee2006a17d5267b3ee4cb%5Eactive%3Dtrue

 

and the page is not found

Hi @chrisshellhamme,

 

When I create the query using the filter condition builder and click copy url I get this:

/rm_story_list.do/?sysparm_query=sys_class_name%3Drm_story%5Eactive%3Dtrue&sysparm_view=scrum

 

Try doing the same with your table and insert the values.

 

This video will help:
https://www.youtube.com/watch?v=spWJe-icus0&list=PL3rNcyAiDYK0YSpjWwmwqcAi2-TriC3-V&index=5

Sheldon  Swift
ServiceNow Employee
ServiceNow Employee

Hi @chrisshellhamme - Try like this:

 

var service = grTS.getValue('cmdb_ci_service');

var baseUrl = window.location.protocol + '//' + window.location.host + '/rm_story_list.do?sysparm_query=';
var query = 'cmdb_ci=' + encodeURIComponent(service) + '^active=true';
var url = baseUrl + encodeURIComponent(query);

window.open(url, '_blank', 'width=800,height=600');