
How IfElse Works:
-
Set a Condition: Define a condition that needs to be met, like
Order amount is greater than $100orCustomer location is in Europe. - Evaluate the Condition: The workflow checks if the condition is true or false.
- Branch Out: Based on the outcome, the workflow follows a predetermined path:
- If True: Execute the actions associated with the
truebranch. - Else: Execute the actions associated with the
elsebranch.
Example Scenario : Check if Order has Discount
Let’s consider an e-commerce workflow where we need to check if an order qualifies for a discount. The criteria could be:- The total order value exceeds $100.
- The customer is a premium member.
- The order is placed during a special promotion period.
Example
Setting up workflow
- Create a
Postmethod which will take body data asorderValue,isPremiumMember, andisPromotionPeriod.

- Using an if-else, evaluate the combined condition to check if the combined criteria are met.

- Add a JSON block with Action name as
true_jsonin True branch withkey=responseandvalue=Discount Applied. Update the Response Block output to{{$true_json.val}}and status code to200.
Sample True Response
- Add a JSON block with Action name as
false_jsonin False branch withkey=responseandvalue=Discount Not Applied. Update the Response Block output to{{$false_json.val}}and status code to200.
Sample False Response

- Click
Deployto update the flow and to utilise your API.
