#PowerPlatformTip 89: 'Code View (Peek Code)'
TL;DR: Inspect an action’s underlying JSON in Power Automate: use Code view in the new designer or Peek code in the classic designer.
💡 Challenge
While working with Power Automate, you might come across situations where you want to understand or utilize expressions used in different actions more effectively. However, finding and understanding these expressions can sometimes be challenging.
✅ Solution
Use Code view in the new designer or Peek code in the classic designer to view the JSON representation of an action or trigger. You can inspect its expressions and settings, but you can’t edit the action directly in that view.
🔧 How It’s Done
Here’s how to do it:
- In the new designer, select the action and choose Code view in its configuration pane.
- In the classic designer, select the action’s ellipsis and choose Peek code.
- Inspect the action JSON and expressions. Edit the action through the designer, not in this view.
Real flow run: the “Build Order Summary” action’s normal run result, “Order for Acme AG: total CHF 150”.
Real flow run: switching to Code View exposes the exact read-only JSON, "inputs": "@concat('Order for ', triggerBody()?['customer'], ': total CHF ', string(add(120, 30)))", behind the same action.
🎉 Result
You gain insight into the expressions used in different actions in Power Automate, which aids understanding of flow logic and supports more effective debugging.
🌟 Key Advantages
🔸 Insight into expressions: Get a deeper understanding of the expressions used in different actions.
🔸 Learning tool: Understand how actions work at the code level.
🔸 Debugging: View and analyze expressions to troubleshoot flow issues.
🎥 Video Tutorial
🛠️ FAQ
1. What are Code view and Peek code?
Code view in the new designer and Peek code in the classic designer show the underlying JSON for a selected action or trigger.
2. Can I edit expressions directly in Code View?
You can’t edit actions directly in Code view or Peek code. To change expressions, use the action designer or expression editor.
3. How does Code View help with debugging?
By exposing the exact expressions and property names, Code View allows you to troubleshoot and understand flow logic more effectively.
🔗 Related Tips
🔸 #PowerPlatformTip 119: ‘Web-Based Editing with VS Code’ - a roomier editor for when Code View’s read-only window isn’t enough.
🔸 #PowerPlatformTip 51: ‘Which Flow Calls Which Flow’ - trace dependencies across flows once you’ve inspected the expressions inside one.
This tip is by Marcel Lehmann, Microsoft MVP (Business Applications) and founder of the Power Platform Academy, which runs free live workshops (in German). See the next free workshop dates (in German). For companies that want this implemented for them, see KMUpower: Power Platform consulting & automation for SMEs (DACH).