Activity condition always returns no

Rachael12
Tera Contributor

I have written a simple code and am getting the correct logs but always No conditions gets triggered.

answer = ifScript();
 
function ifScript() {
var val = gs.getProperty('test_pr');
gs.log("Value: " + val);
    if (val == "test1") {
gs.log("Print no");
        return 'no';
    } else{
gs.log("workflow.scratchpad.test: " + workflow.scratchpad.test);
if(workflow.scratchpad.test == 'test2'){
gs.log('Print test2');
return 'test2';
}
gs.log('Print test complete');
        return 'yes';
}
}

Logs printed :
Value: test1
workflow.scratchpad.test: test2
Print test2
It should return test2 and condition holding activity.result == 'test2' should be called but instead it goes to No condition.

What could be the reason.

1 REPLY 1

GlideFather
Tera Patron

hi @Rachael12 

This script is in a workflow?

 

i’m on a mobile without proper chances to verify myself, but to get:

activity.result == 'test2'

 

try something like:

activity.result == answer

 

eventually try ===

 

keep me updated about your progress

———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */