Complex Conditional Logic

Hi all,

I need some help with writing more complex conditional logic for my backend workflows.

I’m trying to run an API workflow based on the following conditions:

Only When… (A is true AND B is true) OR (A is true AND B is false AND C true) OR (A is false and B is true and C is false) etc etc

Is there any way to do this within a single ‘Only When’ conditional rather than having to write multiple ones. I only want the API to run once so if I split into multiple ‘Only Whens’ this will cause issues.

Thanks

Great question. I’ve struggled with this sort of thing. Even once you’ve written it, it is really difficult to bug test because the logic isn’t particularly readable without going into each section.

What I’ve done is set custom states for each element of the logic and then use those custom states in the main ‘Only when’ clause.

e.g.
Custom state 1 is ‘yes’ if A is true AND B is true
Custom state 2 is ‘yes’ if A is true AND B is false AND C true
Custom state 3 is ‘yes’ if A is false and B is true and C is false
then…

The logic for the workflow is
Only when Custom State 1 is 'yes OR Custom State 3 is ‘yes’ or Custom State 3 is ‘yes’.

I’d be interested if there is a better way of doing this.

1 Like

Ah yes that’s a nice solution! But I’m working with backend workflows so don’t have access to custom states that I can set on the page. I’m trying to create a recurring workflow that conditionally sends an email template based on user attributes from the DB.

Can you do the same thing but with things in the database rather than custom states?

Oh do you mean create a thing in the database to represent a temporary custom state for the logic?

This topic was automatically closed after 70 days. New replies are no longer allowed.