- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 12:56 AM
this is the sample data of text file first coloumn represents location field and second column asset tag how to load this data in data source if parsing then how do i parse with script
Thank you
Solved! Go to Solution.
- Labels:
-
Integrations
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 04:38 PM
One approach is to use the 'Custom (Parse by Script)' format for a data source.
Based on the file you provided, the following parsing script can be used in the data source:
Parsing Script
// The input value can be accessed through the variables named "line", "lineNumber" and "result"
// The function uses result variable to return parse result back.
(function(line, lineNumber, result) {
var map = {};
var items = line.split("|");
map['location'] = items[0];
map['asset'] = items[1];
result.addRow(map);
})(line, lineNumber, result);
Data Source Record

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:04 AM
Follow the steps provided in the following page.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:18 AM
Hi,
txt file is not supported out of the box.
possibly you will have to write custom script to get the txt file content and then transform it
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:32 AM
i have added image of the above sample data how do i tranform it unable to figure out
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 04:33 AM
Hi,
I would suggest to use CSV file
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader