Microsoft Power Automate tips &
tricks, best practices after 3 years
Doctor Flow
ShareQL, Belgium
Here is our experience after 3 years
and 12 enterprise flow projects…
Agenda
Make IT happy
Know the limitations
Maintainability
Reusability
Master Approvals
Use AI
Learn PowerApps
Learn Power BI
Microsoft Graph
Code fast & scalable
Manage throttling
CDS
Watch my Ignite 2019 Orlando sessions
BRK3159
“Become a flow super-hero” (= Flow Advanced-Part 2)
BRK3152
“Energize mission critical enterprise business processes with
Microsoft Flow: patterns, tips and tricks” (= Flow Advanced -Part 1)
Office Apps & services MVP
Business Applications MVP
O365 Architect
@sergeluca
ShareQL Brussels
Office365
Flow
Dev
Architecture
Bullshit
Doctor Flow aka “Serge Luca”
Make IT Happy
Dance
with IT
Power
Architecture
Business
iterates fast,
Talk to IT
Support
Model
Monitoring
Application
Lifecycle
Licensing
Make IT
Happy
Business
Layer
Storage
Layer
UI
Layer
Flows
SharePoint lists & Document libraries, SQL, Analysis
Services, Common Data Service…
Communication
LayerExchange
Online
Analytics
Layer
PowerBI
Logging
Layer
Azure
Applications
Insights
SharePoint
Forms
PowerApps
Forms
SharePoint
Views
Search
Power Architecture
You give
them your
packages
(.Zip) or
Solutions
updated
They must
create a
Maker/Service
Account
Make IT
Happy
You give
them your
packages
(.Zip) or
Solutions
Make Your Code
Maintainable
Code
Maintainable
Use
Scope
Document
&Comment
Reuse
Patterns
Filter Early
Use
Select
Naming
Conventions
Demo
Maintainable Code
Make Your Flows Fast
And Scalable
Minimize
Loops
Avoid
variables
Use
Compose
Filter on the
server first
Use batch
Use
The Filter
action
Use
concurrencyFast
Demo
Code Running Fast
Manage Errors
Log
centrally
(for IT)
Manage
Warning and
Errors
Log
locally
(for the
business)
Use
coalesce()
Use ?
Demo
Manage Errors
Azure Application InsightsMicrosoft Flow Analytics (Admin Center)
Know The Limitations
Key Flow
Limitations
No State Machine
Code Reusability
Loops
500 250
actions/flow
Flow Approval
duration : 30 days
Flow duration : 30
days
No guest access
ALM/devops weak
Cannot resume
flow
API Calls limitation
Controller Pattern
5.000 iterations in Do until and 5.000 in Apply to
Each (Premium gives 100.000 in Apply to each)
Create nested flows or raise a support ticket
Use the CDS trigger : “when a record is
updated” (Premium) or Use the Controller
Pattern
Controller Pattern
Requires 1 Office 365 license for each guest
Power Platform Azure Devops Component or
export/unzip/rezip
In the roadmap
500 calls/5 minutes/user + limitation/24h
depending on the license (2.000 calls/user for
O365 license)
Make Your Code Reusable
Custom
Connector
Flow calls
Flow
Loops
Requires
Premium
Reusability
Boss validates the final document
Secretary Office validates style
Advisors validate content
User Publishes a new “legal” document
State
Machine
State Machine Case 1. Publish a legal document
State
Machine
An employee submits a travel expense
The expense must be approved by a First Line
Manager
If the line manager doesn’t react, it must be
escalated to the Big Boss
Minimize the number of human approvals
Do not approve if we reach the max monthly
corporate expense
State Machine Case 2. Submit a travel expense
Flow
Controller
Pattern
Normal flow
Service flow
Case: Approve a travel expense
Controller
Launcher flow
Line Manager Boss
timeout
approved
rejected
approved
rejected
timeout
Flow Call
Flow
Implemen-
tations
Messages
(Service
Bus)
Database
(SQL Azure)
Http &
When an
HTTP
Request…
Requires
Premium
Requires
Premium
Requires
Premium
Messages
(SharePoint
List)
Run a
child flow
Master Approvals
Demo
Approval Escalation
Approval Adaptive & Teams
Controller Pattern
Controller
Launcher flow
Line ManagerVirtual Boss Boss
Normal flow
Service flow
User x
• Approved
• Rejected
• I don’t know
• Timeout
• Cancelled
Listen to reaction
Create
approval
(don’t wait)
Create
approval
(don’t wait)
New Generation
New use case
An employee submits a travel expense
The expense must be approved by a First Line
Manager
If the line manager doesn’t react, it must be
escalated to the Big Boss
Minimize the number of human approvals
State Machine Case 2. Submit a travel expense
Use AI
(but only in real business cases)
Flow Controller
Pattern and AI Controller
Launcher flow
Line ManagerVirtual Boss Boss
timeout
approved
rejected
timeout
approved
rejected
approved
rejected
I don’t know
Normal flow
Service flow
Case: Approve a travel expense
Azure ML
AI Builder
Learn and Use PowerApps
No elevation
of privilege
Alex
Flow Service
Account
Alex access
SharePoint
PowerApps
Messages
Elevation of
Privilege
This pattern can be
used for elevation of
privilege but also to
minimize usage of
premium license
Flow Service
Account
Flow Service
Account
PowerApps
Only this one requires premium
Premium
Alex
Demo
PowerApps and Power
Automate
Learn and Use
the Microsoft Graph
Demo
Use the Microsoft Graph
New use case
An employee submits a travel expense
The expense must be approved by a First Line
Manager
If the line manager doesn’t react, it must be
escalated to the Big Boss
Minimize the number of human approvals
Do not approve if we reach the max monthly
corporate expense
State Machine Case 2. Submit a travel expense
Learn and
use Power BI
FLOW
DATA ALERTS
DATA SOURCE
POWER BI
REPORTS &
DASHBOARDS
STREAMING DATA
LIVE
POWERQUERY ON SQL AZURE
Requires Premium
Data On premises
REFRESH DATASET)
Query DATASET including with DAX expressions(in 2019)
POWERQUERY
SCHEDULED
REFRESH
LIVE
DATASET
DATASET
SCHEDULE REFRESH
Doctor Flow & Isabelle Van Campenhoudt, 2019
Flow & PowerBI
Conclusions : there is more than that…
• Learn & share
• Make IT happy
• Know the limitations
• Maintainability
• Reusability
• Master Approvals
• Use AI
• Learn PowerApps
• Learn Power BI
• Microsoft Graph
• Code fast & scalable
• Adaptive Cards
• PowerApps Portal
• Common Data Service
• Microsoft Forms
• Azure Functions
• Services Bus
• Azure Event Grid
• Azure API Management
• SQL Azure
• …
Power Automate/ Flow patterns tips and tricks after 3 years with Doctor Flow

Power Automate/ Flow patterns tips and tricks after 3 years with Doctor Flow

Editor's Notes

  • #2 This is the Pre-Title Screen. Please do not place any content on this screen.
  • #3 To add your image, first delete the place holder image as shown in the white box. Then insert your picture and scale it to be bigger than the size of the white box shown. Finally, right click on your image and select ‘Send to back’ – your image should now be framed correctly.
  • #8 Open source picture: https://unsplash.com/photos/j9PpIy_x4EE
  • #13 Get my timesheet: https://emea.flow.microsoft.com/manage/environments/Default-892b3446-d5f0-489e-a68d-605c1613aead/flows/edd198fb-15bb-4fce-96f9-25473cc9ce5e
  • #14 End of demo: 11’ 10’ 10’ 10’ Open gettimesheet maintainable: Show documentation compose talk about deployment Try and catch Show scope Show if_debug
  • #16 Most of the time this is not important When user interaction is involved this is important : PowerApps calls flows Automated flow : ex: create a global counter
  • #17 End of demo 15’ 15’ 14’ 13’
  • #19 In error demo, show that the condition block does not fail if value is null, but the switch does (the status is a choice field)
  • #20 End of demo : 17’ , 19’, 18’ 17’ 16’
  • #23 End of slide : 21’ 22’ ,21;20’
  • #29 End of this : 26 27’
  • #31 End of : 32’,30’,32’,29
  • #32 Todo : CDS diagram : how to cancel Controller pattern video 1 : https://www.youtube.com/watch?v=e8Nuswofodw Controller pattern video 2 : https://www.youtube.com/watch?v=qSYMC20aDiE
  • #37 34’ 36’ 35’ 32
  • #41 Using views instead of tables Instead of traversing from table to table to get your data, expose views where the joins have been made for you. Provided that you’ve correctly indexed your tables, this approach should be very fast, and it will be even faster if you limit the results by using a delegable function that runs on the server. Using stored procedures through a flow for performance The biggest performance improvement that you can make for a PowerApps app that uses Microsoft SQL Server is to call stored procedures from an implementation of Microsoft Flow (that is, a flow). This approach has the added benefit of decoupling your database design from the PowerApps app. Therefore, you can change the underlying table structure without affecting your app. As we’ll explain later, this approach is also more secure. To use this approach in a PowerApps app that already uses the SQL Server connector, you must first completely remove the SQL Server connector from the app. Then create a new SQL Server connector that uses a SQL sign-in that’s restricted to EXECUTE permissions on stored procedures in the database. Finally, in the flow, call the stored procedure, and pass in the parameters from the PowerApps app. For a detailed explanation of how to create the flow and return its results to PowerApps, see Brian Dang’s article, Return an array from a SQL Stored Procedure to PowerApps (Split Method). This approach has these performance benefits: • The stored procedure will be optimized through a query execution plan. Therefore, data will be returned faster. • Delegable calls become less of an issue, because your stored procedure will be optimized to read or write only pertinent data. • Your optimized flow is now a reusable component. Therefore, it’s available to other makers in the environment for common read and write scenarios. https://pahandsonlab.blob.core.windows.net/documents/PowerApps%20canvas%20app%20coding%20standards%20and%20guidelines.pdf
  • #42 Approval antwerpen Create Team End of 37’, 37’ 38’ 36’
  • #44 End of 40’ 40’
  • #47 Powerquery <> oData Refresh dataset and query a dataset + reusing the result https://www.youtube.com/watch?v=Sn3XvkIGBOs&t=401s
  • #49 To add your image, first delete the place holder image as shown in the white box. Then insert your picture and scale it to be bigger than the size of the white box shown. Finally, right click on your image and select ‘Send to back’ – your image should now be framed correctly.