TL;DR: Replace Switch/Condition sprawl by storing options in a JSON object in a Compose action and fetching values dynamically with outputs('Compose')?[key].

💡 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:

  1. 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"
  }
}
  1. 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.

Need Help with Your Power Platform Project?

Get expert guidance through personalized workshops, consulting, and training tailored to your specific needs.

Request Workshop

Consulting and process automation for SMBs is delivered by KMUpower. Prefer structured, German-language courses? The Power Platform Academy offers live Power Platform Schulung and hands-on Power Platform courses for Power Apps, Power Automate and Copilot.