
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 05:10 PM
I created a subflow that I am calling via script from a legacy workflow. I am having problems saving the output values to the scratchpad and using them in another activity.
Subflow*************************************
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 09:23 PM
Hi @Community Alums
You are not passing the result variable as a parameter to your if function. You need to tweak your script as below :
var result = workflow.scratchpad.adsuccess;
gs.log('XX: prescript ' + result + typeof result); //this is printing XX: prescript falsestring which is expected
function ifScript(result) {
gs.log("XX: within script " + result + " " + typeof result); //This is printing XX: within script [object FlowRunnerResult] object which is not expected and causes the rest of the code to fail
if (result == 'false') {
gs.log("XX: yes1");
return 'yes';
}
if(result == false){
gs.log("XX: yes2");
return 'yes';
}
if(!result){
gs.log("XX: yes3");
return 'yes';
}
}
answer = ifScript(result);
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 06:54 PM
Hello @Community Alums
In the "IF Activity" script, the variable 'result' is behaving unexpectedly because it's being used without being passed as a parameter to the function 'ifScript()'.
you can pass 'result' as a parameter to the 'ifScript()' function like this:
answer = ifScript(workflow.scratchpad.adsuccess);
and
function ifScript(result)
{
gs.log("XX: within script " + result + " " + typeof result);
}
If my answer is helpful please mark it as helpful or correct!!
Regards,
Pratima.k
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2024 09:23 PM
Hi @Community Alums
You are not passing the result variable as a parameter to your if function. You need to tweak your script as below :
var result = workflow.scratchpad.adsuccess;
gs.log('XX: prescript ' + result + typeof result); //this is printing XX: prescript falsestring which is expected
function ifScript(result) {
gs.log("XX: within script " + result + " " + typeof result); //This is printing XX: within script [object FlowRunnerResult] object which is not expected and causes the rest of the code to fail
if (result == 'false') {
gs.log("XX: yes1");
return 'yes';
}
if(result == false){
gs.log("XX: yes2");
return 'yes';
}
if(!result){
gs.log("XX: yes3");
return 'yes';
}
}
answer = ifScript(result);
Thanks and Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-22-2024 08:17 AM
Thank you, I knew it was something simple.