Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Load all records in related link of data source is loading only 20 records

Lokesh Pasupul1
Tera Contributor

Hi,

 

I am trying to log all the lines from a txt(in JSON Format data) file which has more than 1000 lines  by using Custom (Parse by script) from data source. When I am clicking load all records in data source its logging only first 20 lines. Can someone help me how to print all the lines from a txt file in data source.

 

TIA

1 ACCEPTED SOLUTION

Harsh_Deep
Giga Sage
Giga Sage

Hello @Lokesh Pasupul1 

 

You can use this script-

var tableName = 'sys_data_source'; // on which table that txt attachment is exist
var sysIdOfRecord = 'b6b9fcd287deb190102543f50cbb3587'; //sys_id of record
var fileNameWithoutExtension = 'payload'; // file name of the file without extension
var grWithAttachment = new GlideRecord(tableName);
grWithAttachment.get(sysIdOfRecord);
var gsa = new GlideSysAttachment();
var dataInTextFile = gsa.get(grWithAttachment, fileNameWithoutExtension);
gs.info(dataInTextFile);

//you will get all the data from txt file into dataInTextFile variable.

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

View solution in original post

2 REPLIES 2

Harsh_Deep
Giga Sage
Giga Sage

Hello @Lokesh Pasupul1 

 

You can use this script-

var tableName = 'sys_data_source'; // on which table that txt attachment is exist
var sysIdOfRecord = 'b6b9fcd287deb190102543f50cbb3587'; //sys_id of record
var fileNameWithoutExtension = 'payload'; // file name of the file without extension
var grWithAttachment = new GlideRecord(tableName);
grWithAttachment.get(sysIdOfRecord);
var gsa = new GlideSysAttachment();
var dataInTextFile = gsa.get(grWithAttachment, fileNameWithoutExtension);
gs.info(dataInTextFile);

//you will get all the data from txt file into dataInTextFile variable.

 

Mark Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.

Thanks much, It works !!