Code not working in script step in flow designer whereas it is perfectly working fine in background

Ct111
Tera Sage

Hello community members,

 

Code not working in script step in flow designer whereas it is perfectly working fine in background.

Any idea what could be the reason?

 

//background script works fine gives the content present in text file.

 

var output = '';
var is = new GlideSysAttachment().getContentStream(sysid);
var reader = new GlideTextReader(is);
var ln = ' ';
while((ln = reader.readLine()) != null) {
// gs.info(ln);
output = ln;
gs.print(output);

}

 

 

 

 

// Same script not  fine in Script Step in action

(function execute(inputs, outputs) {
var is = new GlideSysAttachment().getContentStream(inputs.AttachmentSysid);
var reader = new GlideTextReader(is);
var ln = ' ';
while((ln = reader.readLine()) != null) {
 // gs.info(ln);
  outputs.data = ln;
//gs.print(outputs.data);
 
}
})(inputs, outputs);

 

 

Please assist if you can let me know what needs to be changed in code in flow side

3 REPLIES 3

Ct111
Tera Sage

Any update can anyone assist here?

Reyes
ServiceNow Employee
ServiceNow Employee

it could be a scope issue, instead of getContentStream() can you try getContentBase64() and output the results in /sys.scripts.do in the same scope as the flow

Adam Hunley
Tera Expert

I have the same issue and I have opened a case with support a month ago. They are still trying to figure out the issue.