Tips Tricks with MS Flow Microsoft Flow John

  • Slides: 49
Download presentation
Tips & Tricks with MS Flow Microsoft Flow John Calladine

Tips & Tricks with MS Flow Microsoft Flow John Calladine

About John. C John is an IT Pro with nearly 30 years’ experience in

About John. C John is an IT Pro with nearly 30 years’ experience in the Microsoft technology space. Originally from England, he’s been in Boston for over twenty years. John set up his own consulting company JCPC Consulting llc. back in 2014, and specializes in Office 365 and Share. Point architecture. Company website www. jcalladine. net Outside work, John is a triathlete, keen skier, wine teacher and bon vivant. Email: john@jcalladine. net

Agenda This session includes a deep introduction to Flow and some “almost programmy” ways

Agenda This session includes a deep introduction to Flow and some “almost programmy” ways to get it to work for you. • Regular stuff 1. 2. 3. 4. Microsoft Flow Basics Trigger off a Share. Point list Dealing with Loops and Conditions Having fun with Expressions • More Advanced Stuff 5. 6. 7. 8. Nested trigger off a Power. Apps Using variables, arrays and structures to create objects Pass objects across a Flow to launch web requests or other flows Tips and tricks for maintenance and moving Flows between sites/tenants.

Who has used Flow? Who claims to have programmed? Audience Poll

Who has used Flow? Who claims to have programmed? Audience Poll

1. MS Flow Basics TRICK Don’t use IE to design flows • Kick-off using

1. MS Flow Basics TRICK Don’t use IE to design flows • Kick-off using Triggers What you Need to Get Started • Design you flows based on Actions Office 365 MS Flow “free” license Premium license • “Events” • Changes to the underlying data source • P 1 ($5 per user per month) • P 2 ($15 per user per month) What are the Limits - Currently 750 individual runs per user per month - Free license. 50, 000 total runs • You can pay $5/m for overage

1. MS Flow Connects to many Data Sources • 200+ included • ~50 premium

1. MS Flow Connects to many Data Sources • 200+ included • ~50 premium (P 1/ P 2 license) Not Just Office 365 products! TRICK Use the Free version! Unless you need premium https: //flow. microsoft. com/en-us/connectors/

Type Button in the search 2. Useful Triggers • Flow Button for Mobile •

Type Button in the search 2. Useful Triggers • Flow Button for Mobile • Power. Apps

2. Trigger off a Share. Point list When a new item is created in

2. Trigger off a Share. Point list When a new item is created in a Share. Point list • Fires off the trigger, which Flow can detect 1. Connect to the data source 2. Configure the trigger 3. Add some actions GET STARTED https: //us. flow. microsoft. com

2. You can see the Dynamic Data • Every data source exposes its data

2. You can see the Dynamic Data • Every data source exposes its data in the Dynamic Content : • Lists all the data elements in the SP List • Demo 1 Share. Point list is On Boarding Don’t see everything? See more

Demos 1 & 2 Taking some actions when a user has added a new

Demos 1 & 2 Taking some actions when a user has added a new item to Share. Point list

Tricks – Improve Emails with HTML tags Switch On HTML

Tricks – Improve Emails with HTML tags Switch On HTML

Test Your Flows by re-using Data

Test Your Flows by re-using Data

Tricks to Get Started • • Click the Flow icon on the App Launcher

Tricks to Get Started • • Click the Flow icon on the App Launcher in O 365! Use a template , or start from scratch Use an HTML 5 browser (Chrome or Firefox) Make a data Connection Choose one Trigger Start adding your Actions Name every Step by changing the LABEL before anything else! • QUICK TIP: launch from any SP Modern List

3. Dealing with Loops & Conditions Loops are iteration over a group (Collection) of

3. Dealing with Loops & Conditions Loops are iteration over a group (Collection) of objects Apply to Each Object in Collection Of Objects • Then you deal with each Object in turn Eh? • Say you have a group of users you email • You want each user to receive an individual email • Time for a Loop!

3. Loop Types in MS Flow Apply to Each Iterate over Objects in a

3. Loop Types in MS Flow Apply to Each Iterate over Objects in a Collection Apply to Each Object in [Container of Objects] Do Until Loop until a condition is met • DANGEROUS! when not met… TIP Set an iteration max

3. Dealing with Conditions Condition are a switch between two alternatives IF (Test for

3. Dealing with Conditions Condition are a switch between two alternatives IF (Test for True) Then Action 1 Else Action 2 • If Then Else • If This then That If the User lives in MA Then Invite them to a party in Boston Else Invite them to NYC Multiple Choices are a SWITCH Switch Between Choices (Choice 1) Then Action 1 (Choice 2) Then Action 2 (Choice 3) Then Action 3 (Default) Then Action. Default

3. Branch Types in Flow Condition Switch

3. Branch Types in Flow Condition Switch

Example Condition Demo 3 Weather • If you live in the US • Show

Example Condition Demo 3 Weather • If you live in the US • Show units Imperial • Else • Show units Metric Download the App for your Phone

Demos 3 Dealing with Loops and Conditions

Demos 3 Dealing with Loops and Conditions

Tips with Loops & Conditions • For Each appears automatically for Grouped data •

Tips with Loops & Conditions • For Each appears automatically for Grouped data • Conditions are Case Sensitive • Every If (Yes) must have an Else (No) action • Always add a Default Action for choices • Start to add Scopes where multiple actions involved • Label your Scope • Make sure your loop can finish!

4. Having fun with Expressions • Expression – methods to change data to fit

4. Having fun with Expressions • Expression – methods to change data to fit your needs • Think Excel FUNCTIONS • Change a US Date into something rest of the World can understand • So what does the following mean: • 4/1/18 ? • 4 th of January 2018 for Europe • Flow comes with an Expression Builder! • format. Date. Time( utc. Now(), "dd-MMM-yy") • 1 -Apr-2018 Custom date-and-time format strings

4. Expressions You’ll Want Changing Date Displays convert. Time. Zone( utc. Now(), 'UTC', 'Eastern

4. Expressions You’ll Want Changing Date Displays convert. Time. Zone( utc. Now(), 'UTC', 'Eastern Standard Time', 'g') format. Date. Time( utc. Now(), 'dd-MMM-yyyy') add. Days(trigger. Body()? ['Hire. Date'], 7 ) Create a Mail Link <a href=‘mailto: [email address]’> [display name]</a>

4. TIP: Design Conditions in Pseudo Code • Write it in Pseudo Code first:

4. TIP: Design Conditions in Pseudo Code • Write it in Pseudo Code first: if [Hire. Date] less than today add 7 days to today else add 7 days to [Hire. Date] • Becomes: Attempt 1 if(trigger. Body()? ['Hire. Date'] < utc. Now(), add. Days( utc. Now(), 7) , add. Days(trigger. Body()? ['Hire. Date'], 7) ) Attempt 2 if( less(trigger. Body()? ['Hire. Date'], utc. Now() ), add. Days( utc. Now(), 7) , add. Days(trigger. Body()? ['Hire. Date'], 7) )

Demos 4 Fun with Expressions

Demos 4 Fun with Expressions

Expression Tips • There are Case Sensitive • Every ( must have a )

Expression Tips • There are Case Sensitive • Every ( must have a ) • Strings must be in ' single quotes ' • Think Symmetry! • Keep testing them out in Emails • Use the More button • Think Negatively! - for conditional testing • When Content is Null (means there’s nothing – useful test) • Use Pseudo code to design your expressions

More Expressions Tips • Try simple ones, first! • Test using Email • KEEP

More Expressions Tips • Try simple ones, first! • Test using Email • KEEP ON TRYING to refine • (sounds like a loop to me) • Hit the See more • There are no Spaces in functions

More Advanced Stuff We are all programmers!

More Advanced Stuff We are all programmers!

But First a Diversion. . . • How do you think your Work Flow

But First a Diversion. . . • How do you think your Work Flow should work? • What is the business process you are emulating? • How do you get started? Time to Design Your Work Flow

Design your Flows on Paper First TIP Or use Visio

Design your Flows on Paper First TIP Or use Visio

Example Real Flow Design

Example Real Flow Design

FINSIHED MS Flow • Document Approval • Legal Review • Get Signatures

FINSIHED MS Flow • Document Approval • Legal Review • Get Signatures

5. Trigger Flow off a Power. Apps • upgrade on Info. Path • Form

5. Trigger Flow off a Power. Apps • upgrade on Info. Path • Form or App generator tool • “Free” with Office 365 • User presses a button on Power. Apps form to start a Flow • Sounds like a trigger to me!

Demos 5 Triggers from Power. Apps. Passing data from Power. Apps to Flow.

Demos 5 Triggers from Power. Apps. Passing data from Power. Apps to Flow.

5. Nested Trigger off a Power. Apps Pass data from Power. Apps to Flow

5. Nested Trigger off a Power. Apps Pass data from Power. Apps to Flow • User enters some data into the form and we use it in Flow • Now we can use that data inside the flow and store it somewhere 1. Create a Form 1. 2. 3. 4. Text box [Strings] Drop downs [Choices Check boxes [Yes/ No] Button to be the action item 2. Be proactive to name each element 3. On the Action for the button connect to the Flow

Tricks with Power. Apps • Use Power. Apps straight from Share. Point • Modern

Tricks with Power. Apps • Use Power. Apps straight from Share. Point • Modern Lists and Doc Libraries only • Add a Button and Text box • Name them • Button action to connect with a Flow • No spaces in object names. • Use prefixes e. g. txt. Input, cmd. Button

Full On Boarding Flow

Full On Boarding Flow

6. DEFINITIONS: Variables, Arrays, Objects • Variable – information stored in a named bucket

6. DEFINITIONS: Variables, Arrays, Objects • Variable – information stored in a named bucket Joe 1 • Array – a group of objects stored in labelled cubby hole • Object – something with lots of information 4 2 5 3 6

6. Using Variables, Arrays & Objects • Add a Variable to a Flow (Initialize)

6. Using Variables, Arrays & Objects • Add a Variable to a Flow (Initialize) 1. Give it a Name • Don’t use Spaces 2. Choose the data type • • • Boolean Integer Float String Object Array 3. Assign an initial Value TIP You can only add Variables at the Start, after Trigger BONUS Change this label

6. Variables • Hang on, I didn’t see a Date in the variables…. •

6. Variables • Hang on, I didn’t see a Date in the variables…. • Use a Float ! • Dates are actually the number of days since T 0 , and below the decimal is fractions of the day • 1893. 37619 Data Type Examples Boolean Yes / No True / False Integer 1 / 2 / 3 Float 987. 2345 String “Hello World” Object JSON structure - see slide 6 a Array {“Red”, “Green”, “Blue”} { 1, 2, 3, 5, 8, 13}

6. Working with Variables What you Can Do • Initialize TIP Initialize comes First

6. Working with Variables What you Can Do • Initialize TIP Initialize comes First • Then Set/ Add or Decrease

Demos 6 Using Variables Understanding Arrays Creating Objects

Demos 6 Using Variables Understanding Arrays Creating Objects

Tips with Variables • Name each variable • Don’t use Spaces • Assign a

Tips with Variables • Name each variable • Don’t use Spaces • Assign a data type • Give it an initial value • BONUS - label the variable too ! • Variables MUST be declared at Top of Flow • Dates are stored as FLOAT • Use the INITIALIZE VARIABLE to create a new one • Use the SET VARIABLE action to change a variable

6 a. JSON Notation • Now we are getting programmy! • JSON is simply

6 a. JSON Notation • Now we are getting programmy! • JSON is simply the notation for marking up the MS Flow • Bit like XML • but with { and : • Instead of < and = • Sometimes we HAVE to edit it • And we need it to create objects "When_an_item_is_created": { "recurrence": { "interval": 5, "frequency": "Minute" }, "split. On": "@trigger. Body()? ['value']", "metadata": { "flow. System. Metadata": { "swagger. Operation. Id": "Get. On. New. Items" } }, "type": "Api. Connection", "inputs": { "host": { "api": { "runtime. Url": "https: //msmanaged-na. azureapim. net/apim/sharepointonline" }, "connection": { "name": "@parameters('$connections')['shared_sharepointonline']['connection. Id']" } }, "method": "get", "path": "/datasets/@{encode. URIComponent('https: //XXX. sharepoint. co m/sites/documents'))}/tables/@{encode. URIComponent('157 b 8 b 37 -c 931 -4 f 13 -ad 47 -51 a 5 a 0 daa 734'))}/onnewitems", "authentication": "@parameters('$authentication')" }

Tips with Arrays & Objects • Arrays start counting at 0 • To add

Tips with Arrays & Objects • Arrays start counting at 0 • To add an item use the Append to Array action • Objects are stored in JSON

8. Tips and Tricks for Maintenance & Moving Flows between sites/tenants 1. Be generous

8. Tips and Tricks for Maintenance & Moving Flows between sites/tenants 1. Be generous and Share your flow • Add users and other owners to your flow 2. Even though you ARE a citizen developer, Flows run under YOUR account 3. Rename flow and provided meaningful descriptions to fit the purpose TIP 4. Save Flow as Template Let others re-use your flow 5. xxx TIP Ask admins for generic account, and port to that user

8. Debug Flows • You Can’t Debug a Flow • But you can view

8. Debug Flows • You Can’t Debug a Flow • But you can view flow history • Inspect each step • Look at the values • Evaluate the broken steps in Red

Demos 8 Maintaining Flows, Moving between Tenants, Debugging

Demos 8 Maintaining Flows, Moving between Tenants, Debugging

Everything Revolves Around Flow! Office 365 “secret” tool to help citizens programmers build useful

Everything Revolves Around Flow! Office 365 “secret” tool to help citizens programmers build useful business workflows GO BUILD ONE TODAY!

More Information on MS Flow • Flow Licensing • Overview & Demo (You. Tube:

More Information on MS Flow • Flow Licensing • Overview & Demo (You. Tube: 45 mins) • Automating your Tasks with Flow (slide show) • Expressions & How to Use Them • Custom date-and-time format strings • How to convert string datetime data-types • Patterns for handling Flow Errors • Hidden Gems Don’t do it this way Use format. Date. Time( ‘MM/d/yy’)