💡 Challenge
Standard use of Switch or Condition in Power Automate can often be bypassed for more streamlined processes.
✅ Solution
Pass a simple identifier to Power Automate. Use a dynamic formula to retrieve corresponding data, avoiding complex structures.
🔧 How It’s Done
Here’s how to do it:
- Add a Compose action in Power Automate with a structured JSON object.
🔸 Use a JSON object with keys “A”, “B” and “C”.
🔸 Example:
{ “A”: { “Title”: “Ok”, “Description”: “Text” }, “B”: { “Title”: “Confirmed”, “Description”: “Approved” }, “C”: { “Title”: “Denied”, “Description”: “Rejected” } }
- Use a dynamic formula to retrieve the desired value.
🔸 To get the Title:outputs('Compose')?[InputValue]?['Title']
🔸 To get the Description:outputs('Compose')?[InputValue]?['Description']
🎉 Result
This method allows fetching specific data (‘Title’ or ‘Description’) for different entries (‘A’, ‘B’, ‘C’) without needing complex conditions or switches.
🌟 Key Advantages
🔸 Streamlines data retrieval
🔸 Reduces workflow complexity
🔸 Enhances performance
🎥 Video Tutorial
🛠️ FAQ
1. What are the benefits of using a structured JSON object instead of Switch or Condition?
Using structured JSON avoids multiple branches, simplifies maintenance, and speeds up data retrieval.
2. Can this approach handle more than three cases?
Yes, you can add as many keys and values to the JSON object as needed.
3. How do I handle missing or invalid input values?
Implement default values or wrap the expression with error handling, e.g. using coalesce
or condition checks before accessing the value.
Leave a comment