Logic Apps Switch statement. Conditions inside condition

Drent, Henk 1 Reputation point
2021-09-16T10:44:36.527+00:00

Hi,
I have a switch statement in my logic app and want to achieve the following.

  • In case A (Contract) I want to start an action
  • In Case B or C (Opportunity or Lead) I want to start another action
  • In all other cases I want to cancel the event

The first and last option are pretty easy, using a switch statement.
It's the second option I can't seem to get my head around.
Obviously the way I tried to do it doesn't work (see image)

132686-image.png

I don't want to make separate cases for Case b (Opportunity) and Case C (Lead) because the following actions are the same.

What would be the best way to achieve this?
Thnx in advance
Henk

Azure Logic Apps
Azure Logic Apps
An Azure service that automates the access and use of data across clouds without writing code.
2,947 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Vikram 96 Reputation points
    2021-09-16T13:01:10.59+00:00

    I can think of two possible solutions for this:

    Easy Approach:
    Create an additional variable SourceTypeTemp and use that in the On Part.
    Add an if condition before the Switch Case and Set the SourceTypeTemp value as "Opportunity" even when the value is "Lead". This ensures you have retained the original value within the SourceType variable as well and only the Temp variable has the merged value and also solving your issue.

    Using Expressions:
    The On part of the Switch Statement supports expressions. So you could possibly use the "or" expression to check if the value is equal to either "Opportunity" or "Lead" to return true. In the Case you can use true and false to route.
    Reference for or: Link

    0 comments No comments