- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 01:39 PM
Hi,
I would like to have the general overview / method as to how I can import data from a txt file and insert it into a table.
The client will drag and drop the txt file into an import table, then will click on UI action that will start the import.
A helpful answer would specify if there is a need for an intermiediate table, and how to insert the data into the target table.
An example would be very helpful.
This is what the txt file looks like:
NAME;FIRSTNAME;IDENTIFIANT;CURRENT_STATUS
JEAN;SYLVIE;A80625;ACT
PAUL;DANIEL;T80409;ACT
LEA;FRANCOIS;H0P437;ACT
Thank you,
OH
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 02:28 PM
Hi,
Yes you can read the content of the attachment and use it in the record. Please find the below link of a Article by Abhishek.
var tableName = 'incident';
var sysIdOfRecord = 'b98d17f11ba73300364d32a3cc4bcb29';
var fileNameWithoutExtension = 'Demo'; //Full file name: example text doc.txt
var grWithAttachment = new GlideRecord(tableName);
grWithAttachment.get(sysIdOfRecord);
var gsa = new GlideSysAttachment();
//ONLY works in global
var dataInTextFile = gsa.get(grWithAttachment, fileNameWithoutExtension);
Above piece of script from Article would be useful for you in reading the content on the attachment.
you can write a code in your ui action to read an attachment on the record and using glide record you could insert/update a record on other table.
Kindly mark my answer as Correct and Helpful based on the impact.
Regards,
Chaitanya

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 01:50 PM
Hi,
Please follow the below links:-
https://www.youtube.com/watch?v=6yGke5WSf9A
If i was able to solve your query, Please mark my answer correct and helpful.
Thanks & Regards
Prasant kumar sahu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 01:54 PM
using the load data and import set feature in SN, the data can be loaded and transform to target table. The only issue is that I don't think that ; is an acceptable delimiter symbol ( pipe, comma and tabs are currently supported).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 02:08 PM
Can we do the import without going through an import set. That's the whole reason I asked the question.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-26-2020 02:28 PM
Hi,
Yes you can read the content of the attachment and use it in the record. Please find the below link of a Article by Abhishek.
var tableName = 'incident';
var sysIdOfRecord = 'b98d17f11ba73300364d32a3cc4bcb29';
var fileNameWithoutExtension = 'Demo'; //Full file name: example text doc.txt
var grWithAttachment = new GlideRecord(tableName);
grWithAttachment.get(sysIdOfRecord);
var gsa = new GlideSysAttachment();
//ONLY works in global
var dataInTextFile = gsa.get(grWithAttachment, fileNameWithoutExtension);
Above piece of script from Article would be useful for you in reading the content on the attachment.
you can write a code in your ui action to read an attachment on the record and using glide record you could insert/update a record on other table.
Kindly mark my answer as Correct and Helpful based on the impact.
Regards,
Chaitanya