URL is too large
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 02:38 AM
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:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 03:09 AM
Hi,
There is limit of character for URLs.
You have to fine tune your query.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 03:58 AM - edited 01-08-2023 04:30 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 05:30 AM - edited 01-08-2023 05:31 AM
Hi,
You can directly apply the sysparm query on incident instead of sending sys_ids.
Thanks and Regards,
Saurabh Gupta
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-08-2023 05:53 AM
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.