- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 05:42 AM
list =[sys ids of records];
var tablerec = '<table><thead><tr><th>Incident Number</th></tr></thead><tbody>';
var baseURL = gs.getProperty('glide.servlet.uri');
for (var i = 0; i < list.length; i++) {
var url = new GlideURL('incident.do');
url.addParam('sys_id', list[i]);
var link = baseURL + url.getURL();
tablerec += '<tr><td><a href="' + incidentLink + '">' + list[i] + '</a></td></tr>';
}
tablerec += '</tbody></table>';
am
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 06:07 AM
Hi Priti,
Thats because yoru list array contains the sys_ids and not the numbers.
list =[numbers seprated by commas];
var tablerec = '<table><thead><tr><th>Incident Number</th></tr></thead><tbody>';
var baseURL = gs.getProperty('glide.servlet.uri');
var gr = new GlideRecord("incident");
gr.addEncodedQuery("numberIN"+list);
gr.query();
while(gr.next()) {
var url= '<a href="' + gs.generateURL(gr.getTableName(),gr.sys_id) + '">' + gr.number+ '</a>';
tablerec += '<tr><td>'+url+'</td></tr>';
}
tablerec += '</tbody></table>';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 05:48 AM
Hello Priti,
1. Glideurl is a client side object. you cannot use it in server side
2. if you want to fetch the url, then you can modify the code slightly like this
list =[sys ids of records];
var tablerec = '<table><thead><tr><th>Incident Number</th></tr></thead><tbody>';
var baseURL = gs.getProperty('glide.servlet.uri');
for (var i = 0; i < list.length; i++) {
var url = "incident.do?sys_id="+list[i]+"";
var link = baseURL + url;
tablerec += '<tr><td><a href="' + incidentLink + '">' + list[i] + '</a></td></tr>';
}
tablerec += '</tbody></table>';
Mark the comment as a correct answer and helpful if this helps to solve the problem.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 05:58 AM
I am able to get link of records but the hyperlink shows as the sys id of those records i need numbers.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 06:07 AM
Hi Priti,
Thats because yoru list array contains the sys_ids and not the numbers.
list =[numbers seprated by commas];
var tablerec = '<table><thead><tr><th>Incident Number</th></tr></thead><tbody>';
var baseURL = gs.getProperty('glide.servlet.uri');
var gr = new GlideRecord("incident");
gr.addEncodedQuery("numberIN"+list);
gr.query();
while(gr.next()) {
var url= '<a href="' + gs.generateURL(gr.getTableName(),gr.sys_id) + '">' + gr.number+ '</a>';
tablerec += '<tr><td>'+url+'</td></tr>';
}
tablerec += '</tbody></table>';
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-16-2023 05:59 AM
can you share your complete business requirement here?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader