
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-23-2023 02:44 PM
I am using the custom SSH activity File Read in a workflow. It successfully connects and retrieves the file contents but when I try to check the output using this script
var obj = data.get(7).output;
var str = JSON.stringify(obj);
gs.log("The object " + str);
workflow.scratchpad.linux = str;
The next If statement returns an error 'undefined.'
answer = ifScript();
function ifScript() {
if (workflow.scratchpad.linux.indexOf(workflow.scratchpad.user) > -1) {
return 'yes';
}
return 'no';
}
Error from logs
If Linux Account exists(8f10bd86dba4e11025f351fcd396194c): org.mozilla.javascript.WrappedException: Wrapped ConversionError: The undefined value has no properties. ( answer = ifScript();
function ifScript() {
if (workflow.scratchpad.linux.indexOf(workflow.scratchpad.user) !== -1) {
return 'yes';
}
return 'no';
}; line 4) (sys_script_include.365eca63c0a8016600069528aee5affb.script; line 117)
This is the same script I use when parsing a Query AD activity so maybe that is my problem. I'm not yet very good at scripting so my process is to copy and tweak what I know works.
What am I doing wrong here?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 09:16 AM
Hi @tsutherland - looks like the issue is with the data mapping.
the validation is : either data.get(**).result ( which will show you result ) or data.get(**).contents ( this will show you content of the output ).
Based on this you can find out the index of user you are seeking. you can also use .includes() method instead of index of.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-08-2023 09:16 AM
Hi @tsutherland - looks like the issue is with the data mapping.
the validation is : either data.get(**).result ( which will show you result ) or data.get(**).contents ( this will show you content of the output ).
Based on this you can find out the index of user you are seeking. you can also use .includes() method instead of index of.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 10:04 PM
It was really helpful. I have fixed this issue with the help of this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-09-2023 10:11 PM
Thank you