Custom if activity in workflow

sowmyaj
Giga Expert

Hi Everyone,

I have created if condition with custom activities based on multiple condition as shown below, the condition is true and log messages are captured but the return value is "no" instead of returning a string based on condition match and   which will not match with activity.result and failing the flow of workflow. Please let me know how to fix it.

find_real_file.png

one of the activities condition

find_real_file.png

Thanks,

Sowmya

1 ACCEPTED SOLUTION

Hi Sowmya,



I recently came across a similar situation, and as a workaround used   several redundant workflow.scratchpad in the if   else ladder, and later used a switch .The switch conditions for paths had the workflow scratchpad.



For eg.


in run script :


if(this ==this){


workflow.scratchpad.first='true';


}


else if(this== that){


workflow.scratchpad.first='true';


workflow.scratchpad.second='true';


}


else{


workflow.scratchpad.first='true';


workflow.scratchpad.second='true';


workflow.scratchpad.third='true';


}




in switch conditions,   for one path i used   workflow.scratchpad.first=='true';     similarly i used workflow.scratchpad.second='true'; in other and so on..


View solution in original post

7 REPLIES 7

Chuck Tomasi
Tera Patron

It sounds more like you want a Switch statement than an "if". An if usually returns a binary "yes" or "no". You might have better luck with a switch as it is designed to handle multiple cases more effectively.


Thank you.



Switch is based on field/variable but I need to have multiple variables as shown in the earlier snippet and only when all condition meets I need to trigger a particular task for which "switch" doesn't work. Please let me know why adding activities in "If" condition won't work?. Also, please suggest me how can I replicate the requirement if not using "IF condition".



Thanks,


Sowmya


Hi Sowmya,



I recently came across a similar situation, and as a workaround used   several redundant workflow.scratchpad in the if   else ladder, and later used a switch .The switch conditions for paths had the workflow scratchpad.



For eg.


in run script :


if(this ==this){


workflow.scratchpad.first='true';


}


else if(this== that){


workflow.scratchpad.first='true';


workflow.scratchpad.second='true';


}


else{


workflow.scratchpad.first='true';


workflow.scratchpad.second='true';


workflow.scratchpad.third='true';


}




in switch conditions,   for one path i used   workflow.scratchpad.first=='true';     similarly i used workflow.scratchpad.second='true'; in other and so on..


Thank you.



Can you please let me know what is the purpose of setting all the scatchpad variable to true in "Run script" as the loop gets increased.


Please help me out in switch condition as I'm not able to find advanced script field to add "workflow.scratchpad.first=='true'; " and so on.   It will be great help if you show me steps for adding the condition in switch.


find_real_file.png



Thanks,


Sowmya