Remote Table Definition
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 04:31 AM
Hi everyone,
I was experimenting with remote tables to understand how they work. I successfully fetched records from an open-source API, and they are visible in the list view. However, when I open a record, it always displays the first record fetched, even though the list shows all records pulled via the API. Initially, I thought this might be due to a missing sys_id, so I added a sys_id to each record. Now, all records have a unique sys_id, but when I try to open a record, I get a "record not found" message. Any suggestions on what might be going wrong?
try {
var r = new sn_ws.RESTMessageV2('Visitor stat', 'Default GET');
r.setStringParameterNoEscape('lang', 'en');
r.setStringParameterNoEscape('full_series', '1');
var response = r.execute();
var responseBody = response.getBody();
var httpStatus = response.getStatusCode();
responseBodyJSON = JSON.parse(responseBody);
// var allData = [];
if (httpStatus == 200) {
for (var i = 0; i < responseBodyJSON.dataSet.length; i++) {
var rawObj = {
'sys_id': gs.generateGUID(),
'u_period': responseBodyJSON.dataSet[i].period,
'u_regiondesc': responseBodyJSON.dataSet[i].REGIONDesc,
'u_region': responseBodyJSON.dataSet[i].REGION
};
v_table.addRow(rawObj);
}
}
} catch (ex) {
var message = ex.message;
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 04:34 AM
it should work ideally as you are generating the sysId in script
can you check this?
Example 2: Retrieving specific records from a third-party source
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 04:58 AM
I have been looking into the Example 2 documentation but I wasn't sure what part of the script I should incorporate into my script.
Kind regards,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-24-2025 05:08 AM
the example informs how to use API to get the data and store in remote table
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader