- Post History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Printer Friendly Page
- Report Inappropriate Content
on 10-19-2019 06:39 PM
I am sujan , new to communities but not to Servicenow 😛
Today we discuss about remote Tables in Servicenow , it’s a wonderful feature in Newyork version can be activated in personal Developer instance.
In this article we deal with a simple example to strengthen our understanding on remote tables
Activate Plugin :
Plugin: com.glide.script.vtable
New Application called System Definition > Remote Tables > Tables along with other artifact’s gets deployed .
You create remote tables to describe the schema for the data that you want to retrieve from an external source. The table definition is in the Now Platform, but its rows, or external records, live in the memory. You create a remote table the same way that you would create a standard internal table.
Remote tables gets its records from running an associated script using external data source.
By using a remote table, you can retrieve the data from external sources or from another instance with REST or SOAP services .
Refer the link for more details
Some of the use cases has been mentioned in the docs , however I see this concept has high potential usage with in the
>>Cloud Management Scope ( fetching the dynamics of the Cloud Datacentre Capacities and shown it to the cloud Catalog options
>> Ideally for maintaining the Token id’s we use for the integrations and storing temporarily , along with their validity.
Similar to system tables , but to identify a remote tables starts with u_st
The other difference I have observed that there is only sys field created when we create remote table i.e. sys_id
Remote tables gets its records from an associated script , we can only associate one script for one remote table
Create an Associate Scripts using System Definition >> Remote Tables >> Definitions
In the Caching section, designate how this data is cached and how long the data is cached in the memory of the Now Platform:
Goal is to get the currency values with the base as INR , upto date
Created associated script as follows
(function executeQuery(v_table, v_query) { // Main API: // v_table.addRow({ ... }) - adds a row to the result set
// There are also query helper methods // v_query.getEncodedQuery() - returns encoded querystring // v_query.getCondition(field) - returns encoded querystring for the given field (includes field name, operator, and value) // v_query.getParameter(field) - returns parameter for the given field (only includes value for equality conditions) // v_query.isGet() - returns whether the query is a single get by sys_id // v_query.getSysId() - returns parameter for sys_id field // v_query.isTextSearch() - returns whether the query contains a text query parameter // v_query.getTextSearch() - returns text search query parameter (internal field name 123TEXTQUERY321) // v_query.getFirstRowWanted() - returns the first row to include // v_query.getLastRowWanted() - returns the last row to include
// Note: You must define sys_id for each row so that forms and lists for this table work properly
// Your code goes here // v_table.addRow({...})
fetchAllCurrencies(v_table, v_query);
function fetchAllCurrencies(v_table, v_query) {
var r = new sn_ws.RESTMessageV2('getCurrenciesValbyBaseLine', 'Default GET'); var response = r.execute(); var responseBody = response.getBody(); var httpStatus = response.getStatusCode(); if (response.haveError()) { v_query.setLastErrorMessage(response.getErrorMessage()); return; } var parsedRes = JSON.parse(responseBody); var actVal = parsedRes.rates;
for (var k in actVal) { var row = {}; row["u_currency"] = k; row["u_valininr"] = actVal[k]; v_table.addRow(row); }
}
})(v_table, v_query); |
The Cache TTL determines the refresh interval of the tables and also if a user access the table the data get automatically refreshes in the table , hence use sees the recent data
Will be posting more details about how to develop the script along with various artifacts in the next article
- 3,964 Views
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi ,
Can we use this data for creating reports in ServiceNow?

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
I am afraid not, remote tables are transient tables, which means as soon as your session is terminated the data goes away. These tables are not reportable nor are they designed for reporting purposes
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Can we make the calls to REST Message via Remote Table dynamic?
We have a reference variable on catalog item which refers to RemoteTable. I just need to pickup another string variable value from catolog item & be able to send it in the Query Parameter of REST Message being triggered onChange of other reference field referring to remote table.
- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Report Inappropriate Content
Hi @DS14 ,
Did you managed to acheive it because even we have requirement where we need to pass an input as a parameter and get the table values.
Hi @Venkata Naga Su ,
I know its very late can you please let me know is it possible to send dymanic parameter to rest message in the remote table.
Thanks,