Use sub-flow as custom Condition
Posted: 13 Feb 2014 16:26
Hi
I'd love to have a "custom Condition" workflow-type. Implementation suggestions:
Add a new Condition called "Execute Flow as Condition" or someting similar.
When the parent flow invokes this Condition-type, it executes a single specified subflow and waits for it to complete.
At some point during subflow execution, it can invoke a new Action called "Set Condition Result", specifying if it should be True or False. This Action can be called multiple times in the sub-flow - only the last invocation counts. If the "Set Condition Result" Action is never executed by the sub-workflow, the default Condition Result is False.
When the subflow completes, the parent workflow's "Execute Flow as Condition"-Condition evaluates the variable set in the subflow via "Set Condition Result", and performs normal routing/execution from that point on.
This is already possible to do in a 2-step approach using global variables:
1. Execute the subflow via "Execute Flows" Action. The subflow sets a global variable to "true" or "false".
2. Use an Expression Condition to test the contents of the global variable.
The 2-step approach is workable, just cumbersome if you wish to re-use custom Conditions across multiple flows. Having a "real" custom Condition would be gold .
Cheers,
Morten
I'd love to have a "custom Condition" workflow-type. Implementation suggestions:
Add a new Condition called "Execute Flow as Condition" or someting similar.
When the parent flow invokes this Condition-type, it executes a single specified subflow and waits for it to complete.
At some point during subflow execution, it can invoke a new Action called "Set Condition Result", specifying if it should be True or False. This Action can be called multiple times in the sub-flow - only the last invocation counts. If the "Set Condition Result" Action is never executed by the sub-workflow, the default Condition Result is False.
When the subflow completes, the parent workflow's "Execute Flow as Condition"-Condition evaluates the variable set in the subflow via "Set Condition Result", and performs normal routing/execution from that point on.
This is already possible to do in a 2-step approach using global variables:
1. Execute the subflow via "Execute Flows" Action. The subflow sets a global variable to "true" or "false".
2. Use an Expression Condition to test the contents of the global variable.
The 2-step approach is workable, just cumbersome if you wish to re-use custom Conditions across multiple flows. Having a "real" custom Condition would be gold .
Cheers,
Morten