June 02, 2016

My Hello world example with Microsoft Flow

700 Views

It is a Microsoft new animal targeted for end users, Microsoft Flow helps you work smarter by automating workflow across your apps and different services.

You can connect to almost all applications including Facebook, Slack, Twilio and the count goes on. As of now, Microsoft says, Flow can talk to 34 applications.

Currently it is in Preview version and expect a lot of changes when it goes public.

Is this specific to SharePoint?

No. It is not specific to SharePoint; but you can use it for SharePoint. In SharePoint it is currently enabled for few events like item added/updated. You can’t use Flow for deletion. This may appear when the product goes public.

Can it be used to replace SharePoint Designer workflows?

The answer is YES AND NO. Always depends on the Customer requirements. I have listed some of major the difference.

SharePoint Designer workflows Microsoft Flow
  • Specific to SharePoint
  • It is a standalone product and can connect to almost all the application in office 365 eco system including SharePoint.
  • You can package and re-use it in other SharePoint Sites
  • Not available. If you want the same logic in other places, re-write from scratch.
  • Troubleshooting is bit easier. You get Task List and History List with every workflow.
  • No task/History List. But, you can mimic it by adding items to a custom List.
  • From Email Address is customizable. Can be set in the Flow Email activity.
  • No Lazy approval. You need to perform the workflow actions in SharePoint either by Navigating to SharePoint or opening a SharePoint popup window.
  • You can perform basic operations like Approve/Reject with in your email.
  • You can impersonate the user as workflow Author
  • No Impersonation available.
  • Workflows are visible in SharePoint for users with appropriate permission.
  • No sharing option. Only visible in Microsoft Flow Dashboard and only to the user who created it.
  • If your third party application doesn’t have REST End Point, you will not be able to communicate with them directly.
  • Most of the application are readily available and you don’t have to worry how to connect them. As per Microsoft, you can build custom activity, but as of now, not sure how we do we integrate it.
  • Available on both On premises and Online
  • Available only on Online.

Note: This list may change with the future release of Microsoft Flow.

How do I get it?

It is currently under Preview. Go to https://flow.microsoft.com and signup. You need to have Microsoft account to subscribe to this.

Sample workflow using Microsoft Flow

Scenario: Lets say, you have a custom Leave Request List in SharePoint. When the new items are created the Project Manager should get an approval email. The Manager should have Approve/Reject button in the email. On both Approve/Reject, the requester should get an email.

Note: As this blogs mainly talks on Microsoft Flow, I will skip SharePoint customization and validation part to you.

  1. Create a Custom List say “Leave Request” with the below columns.
Column Name Type
Description(Title) Single line of text
Leave Requests Sick Personal Vacation Compulsory Leave
Comments Multiple lines of text
Start Date Date and Time
End Date Date and Time
Total Number of Days Requested Number
The form will look something like below. Form
  1. Creating the Flow
Microsoft has already 100’s of built in templates. You can use one of the existing one or build one from scratch using Actions and Conditions. Actions and Conditions are similar to the one that we have in SharePoint Designer workflows.
  1. Login to https://flow.microsoft.com using Office 365 account.
  2. Click on My Flows and the click on Create New Flow.
  3. Type SharePoint and select “SharePoint Online – When a new item is created”.Point c
  4. Enter the Site URL, and select the Custom List. In our case list name is Leave Requests.point d
  5. Click on Add an Action. Select Action “Office 365 Outlook – Send approval email” and fill out the Details. This will give us 2 buttons Approve/Reject in the email.point e
  6. Fill out the details.
  7. Adding the Condition
    • Click on + symbol at the bottom and select “Add a Condition”.
    • Fill out the below details. Refer the image below.
    • Object Name: Selected Option.
    • Condition: is equal to
    • Value: Approvepoint g
  8. This Control also adds 2 conditions.
    • Under Yes, Select Send Email control and Fill out the details. Refer the image below. Repeat the same for “No” condition.point h
  9. Below is the final look of our Flow.point i
  10. Give a name to your Flow and Save the changes. Congratulations! Now your workflow is complete and ready to use.
  11. Testing:
    • Make sure, under My Flows your new workflow is Turned on.testing 1
    • Create an Item in your SharePoint “Leave Request” and after few seconds, the approver receives an email with Approve and Reject option.testing 2
    • Clicking on Approve, will execute the Approve section in flow and vice versa when it is Rejected.
Debugging: As mentioned earlier, there is no detailed debugging procedure available. You can check the status of each condition at run time. Once the logic executes, they will show in Green color. point i Conclusion: Go for SharePoint Designer workflow if,
    1. If you have a complex logic which includes calling REST end Points, Dictionary values etc.
    2. CRUD operations on multiple SharePoint Lists.
    3. Need to track workflow activities using Task List and History List.
    4. Planning to reuse the same workflow across multiple site collections and multiple Lists.
Go for Microsoft Flow,
      1. Your IT Governance policy doesn’t allow creating custom workflow using SPD.
      2. Allow end User to create workflow based on their individual needs. Thereby reducing dependency on IT.
      3. Your workflow needs to connect multiple non SharePoint applications.
      4. You want to have a Lazy approval, so that user can Approve/Reject in their email.
  Hope this helps!

Leave a Reply

Your email address will not be published. Required fields are marked *