URL is too large

ar1
Kilo Sage

Hi All,
Can anyone please help us on the below issue.

We created one business rule to set  one table records url in one URL type field called "Data Link" and when an user click on the url it will open new records list view in new tab.

But sometimes when we get more than 50 records url, after click on the url we're getting below error.


Please help us to complete this. 
Advance thanks.

 

Error Image:

ar1_0-1673174117416.png

 

18 REPLIES 18

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
There is limit of character for URLs.
You have to fine tune your query.

 

 


Thanks and Regards,

Saurabh Gupta

HI Saurav,
Many thanks for the response.

Could you please help us how to tune the query. 
Below is the script we're using to set the URL.

Script:

 

(function executeRule(current, previous /*null when async*/ ) {
setLink();

function setLink() {
gs.info("inside function");
var d = [];
var d1 = [];

var di=new GlideRecord('sec_cmn_src_ci');

di.addEncodedQuery('cmdb_ci.sys_class_name=cmdb_ci_firewall_device_cisco^last_scan_dateONLast 90 days@javascript:gs.beginningOfLast90Days()@javascript:gs.endOfLast90Days()^cmdb_ci.operational_status=1');
di.query();
while (di.next())

{
gs.info("inside first loop");
d.push(di.cmdb_ci.toString());

}
var ci = new GlideRecord("cmdb_ci");
ci.addEncodedQuery('sys_class_name=cmdb_ci_firewall_device_cisco^operational_status=1');
ci.addQuery('sys_id', 'NOT IN', d);

ci.query();
while (ci.next()) {
gs.info('inside second loop');
d1.push(ci.getValue("sys_id"));
}

gs.info("d1 is" + d1);

for (var i = 0; i < d1.length; i++)

{
var url = gs.getProperty('glide.servlet.uri') + '/nav_to.do?uri=' + 'cmdb_ci' + '_list.do?sysparm_query=sys_idIN' + d1;

gs.info("link is" + url);
current.u_data_link = url;
}
}

})(current, previous);



Advance thanks.

Saurabh Gupta
Kilo Patron
Kilo Patron

Hi,
You can directly apply the sysparm query on incident instead of sending sys_ids.

 

 


Thanks and Regards,

Saurabh Gupta

Hi Saurabh,
Thanks for the response.

I hope you saw the above script, like what we're trying to accomplish.

We're adding the sys_id's to the url to get the required records , whenever user click on the url.

We got confused , when you're talking about incident query above.

Hope we're clear to you.
Advance thanks.