Certain variables are not being assigned in output Array.Object in flow designer action

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-20-2025 11:22 AM
On Xanadu - glide-xanadu-07-02-2024__patch5-12-24-2024.
I am building an action that will parse through a .csv in the sys_attachment table, and make the data accessible within a flow.
After ascertaining the .csv, parsing the data with sn_impex.CSVParser, and trying to assign it to a defined output of Array.Object, all of the values in the first column of the CSV file are set to null.
An Example:
For this data:
Action:
Inputs:
- Attachment Table SysID (Sys ID (GUID))
- Attachment Table Name (string)
- Delimiter (string)
- Quote Character (string)
Script Step:
Inputs:
Outputs:
Script:
(function execute(inputs, outputs) {
var a_table_name_sys_id = inputs.attachment_sysid;
var a_table_name = inputs.attachment_table_name;
var a_delimiter = inputs.delimiter; // default is ,
var a_quoteCharacter = inputs.quote_character; // default is "
var gsa = new GlideSysAttachment();
var bytesInFile = gsa.getBytes(a_table_name,a_table_name_sys_id);
var originalContentsInFile = Packages.java.lang.String(bytesInFile);
originalContentsInFile = String(originalContentsInFile);
var fileData = originalContentsInFile.split('\n');
var csvheaders = sn_impex.CSVParser().parseLineToArray(fileData,a_delimiter,a_quoteCharacter);
var headers = cleanHeaders(csvheaders); //replace all spaces in csv headers with underscores.
var i = 0;
var csvArray = [];
fileData.forEach(function(line){
try{
var lineObj = new sn_impex.CSVParser().parseLineToObject(line,headers,a_delimiter,a_quoteCharacter);
//gs.info(JSON.stringify(lineObj,'',' '));
csvArray[i] = lineObj;
i++;
}
catch(e){
gs.error("in catch: " + e);
}
});
//gs.info('csvArray: ' + JSON.stringify(csvArray,'',' '));
csvArray.shift();// remove the header object from the csvArray
outputs.users = csvArray;
function cleanHeaders(h){
var ret = [];
for(var i=0;i<h.length;i++){
ret.push(h[i].replace(/ /g,"_"));
}
return ret;
}
})(inputs, outputs);
If you un-comment the gs.info's on lines 20 & 30, you'll notice that the data is all there. The assignment operator on line 32 does not seem to respect whatever column was originally in the first column of the CSV.
Here is the output from testing the action: .
Running a second test with the following data:
results in:
Any thoughts as to why there is a null value appearing from nowhere?
Sample CSV files attached

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2025 10:26 AM
Yes, it works in the background scripts, but not in flow designer actions, which is the problem. I'll create a support case for this. Thanks for your insights and time, Ankur!