- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 12:21 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 02:42 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 02:42 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-17-2023 07:29 AM
Thanks much, It works !!