SOLVED

SharePoint Workflow or Microsoft Flow?

Iron Contributor

Hi all,

I'm well experienced in SharePoint, but have never used workflow (don't ask me how).  In my new role we have the following requirement so I was wondering if you have any advice as to whether SharePoint workflow or Microsoft Flow (or a combination / something else) would be best to use.

The requirement is a process flow around the creation, internal approval and signing of contracts for new consultants (or extending contracts for existing consultants):

  1. I draft a contract in Word 2016 and store the file in a SharePoint doc library.
  2. I currently manually email a link to the contract to others for input / update.
  3. I send a link to the contract to either 1 or 2 managers for approval.
    1. They make any changes they see fit and then email me to tell me it's now OK to be sent to the consultant.
    2. In automating the process, we'd need a feedback loop if further changes are required.
  4. Once approved, the file needs to be sent to the consultant and 'signed'.  Things to note:
    1. We currently convert it to PDF, storing a copy in the same place as the original Word document, so the consultant can't make changes.
    2. We email the PDF to them as an attachment.
    3. They may want changes made so we'd have to go back through the whole update / manager approval cycle.
    4. At the moment, if they're happy with the contract, they print it out, sign it with a pen, scan it and send it back as an email attachment.
    5. We save the signed copy along with the original Word document and PDF.
    6. The consultant may not yet be on our Office 365 system, but if we could build it to use links (rather than email attachments) and give them access to the specific file(s) they need that would be great.
    7. We use Office 365 Business Premium.

This must be crying-out for some kind of workflow / approval automation, so if I can benefit from the Community's wealth of experience as to where to start that would really help.  It's worth noting that I'm an advanced end user rather than developer so would like to solve this with 'out-of-the-box' functionality.

Hope you can help and thanks as always, Oz

31 Replies
IMHO Flow is not what you need here and the same could happen with a SPO workflow....the scenario you have in place it's well covered by third party workflow solutions such as the ones provided by Nintex or K2...another alternative could be to model your process by means of custom development

I think your best-case scenario is Flow can take care of most of each step up to 4 before it runs out of tools.

 

1. If the contracts always go to the same place, you can automate the save process with some VBA tied to a button in a Word template (use Record while saving a document in SharePoint, that'll get you the code to use). Very optional.

2. Use Flow: "When a new item is created, email [person]." If there are conditions to who gets what, you'd want to consider adding a Document Property to a Word template using a SharePoint content type.

3. Similar to 2--try Flow's Approval process, but I am not sure it will handle a feedback loop.

4. Dependent on whether Flow can meet your needs, though Flow won't actually do esignature. I don't believe there is a way in Flow out of the box to save a file as a PDF.

best response confirmed by Oz Oscroft (Iron Contributor)
Solution

Hello Oz,

 

This is a great scenario for Microsoft Flow. I'll walk you through how I built a flow that does essentially what you described below. It's a bit long, but it should cover every single bullet point that you outline. 

 

First, there's a SharePoint document library that you'll upload drafts to. This flow will trigger based on the draft being uploaded to that document library. You can use the When a file is created (properties only) trigger. 

trigger.png

I assume that you don't want to immediately start the approval process when you upload the draft. Instead, I've added a next step that lets you decide when the draft is ready to be sent to the official approver(s). We also can use this step to collect the email address of the consultant that the contract will be sent to (you could also use a custom column in the document library to enter that information - but for the purposes here it's easier to enter it once you kick off the approval section). action1.png

 

Now that the approval process is going to start, you'll need to add a Do until loop. This loop will continue until both the approver(s), and the consultant themselves, have approved the document. That will start out looking like this, once you add the approval step in:

 action2.png

 

For the first approval step inside the do until, you'll want to send a link to the final draft of the contract to the approvers. You can provide any number of approvers on the Assigned To line. You will also want to include a friendly message to the approvers indicating what they are approving. Filled out, that will look like this:action3.png

Now, there are two possibilities - either the approvers liked the contract draft and you can send it off to the vendor, or, they requested revisions and you want to be notified of those comments. To handle these two possibilities, you'll need a condition:condition.png

 

Inside the top condition box, on the left hand side you'll use the Add dynamic content option to pass in the Response from the approver. Let's look at each side of the condition one-at-a-time.

 

Starting with the If no side - we will send you an email requesting your revision. That email will also contain a button that you can click once you are done with the revisions to the contract so you can inform the Flow to restart the approval loop. ifno1.png

 This email, when it gets sent, will look something like this:

4.png

Now, let's look at the If yes side. First, we are going to get the latest word document content so we can send an attachment to the contractor. ifyes1.pngIdeally, you could get a link but since the contractors may not be in your Office 365 tenant, an attachment is likely the easiest way to accomplish this. Next, send an email to the contractor with the document attached:ifyes2.png

 This email, when its sent, will look something like this:6.pngNow, you'll need a second condition to check if the contractor is happy with the contract or not.condition2.png

If they select Revision needed then you'll need to send a similar mail as above to yourself to update the contract. Thus, in the If yes side you'll add this step:ifyes3.png

The flow will now wait for you to edit the word document, and then select the Revisions completed button in your email. When you select that button the approval process will loop to the top again and restart with the latest version of the document. You won't need anything in the If no side because no further revisions are required if the contractor approves.

 

You may have noticed that I skipped over the condition of the Do-until. This is because you need to add the actions inside first, before you can reference them in the Do-until condition. The condition will have two parts, because you want both your approver, and the contractor to approve. To build such a compound condition today you'll use the Edit in advanced mode button. In advanced mode you can use Microsoft Flow's excel-like syntax to build powerful boolean statements. In this case, that expression will look like:

@and(equals(body('Start_an_approval')?['response'], 'Approve'),equals(body('Send_approval_email_to_vendor')?['SelectedOption'], 'Approve'))

The exact values inside the quotes of the body() functions may vary depending on the names of the actions you give in your flow.

 

Now that you have completed the approval loop, the next step is to generate a PDF of the finalized contract and send it to the contractor for signature. First, download the finalized content of the word document:action4.png

In Microsoft Flow, we have a partner, Muhimbi, who provides functionality to generate PDFs from Word documents. If you haven't used Muhimbi before you can sign up for a free trial. That action is very simple, it takes the Word document content from the above step and the file name:action5.png

We will use the generated PDF to send the contract to the contractor for signature. Notice I have included the file name in the subject line, that's important for the next step. You can also provide additional instructions, for example:action6.png

Next, you will have the flow wait for the contractor to respond to the above email with an attachment. The reason that you must include the file name in the subject is because flow will specifically wait for the contractor to respond to that thread - if they happen to send you another email with an attachment in the meanwhile you don't want that being uploaded to your SharePoint. So, add on the When a new email arrives step and fill it out like below:trigger2.pngNotice the use of the file name in the Subject filter, as well as the fact that you're looking for emails that have attachments, and that you want to Include Attachments in the step.

 

The final step of the flow is to upload this attachment to your document library. Be sure to add (signed).pdf to the name of the file.action7.png

The most complicated part of this is email attachments can normally be a list of items -- but in this case you just want the first email attachment. You can use another flow expression to get this attachment by itself. That's what the pink value is above in the File content field. The full expression would look like this:

base64ToBinary(first(first(body('Wait_for_vendor_response')['value'])['Attachments'])['ContentBytes'])

Now you're almost done. However, there is one more change that needs to happen. Because the above attachment is being uploaded to the same document library you're monitoring -- this whole process will also be triggered on the signed PDFs being uploaded. This isn't what you want, so you should go back to the top of the flow, and add one more condition:condition3.png

In the condition, we check to see if the Name ends with (signed). If it does then we immediately terminate the flow. This will prevent you from getting double approval flows. You could also accomplish something similar by having a separate document library for your signed PDF's. In the end the full flow looks like this:fullflow.png

 

I hope that this was useful for you to see how this could be done in Microsoft Flow. If you don't mind, I would like to blog about this scenario on the flow blog because I think it's a very interesting one (let me know if that's okay!). I can also make a template out of this flow if you're okay with it being public -- then you can just use that template and you won't have to configure it all yourself based on these instructions :)

 

Let me know what feedback you have, and I would love to hear if you find this meets your needs or not.

 

 

 

Thank you,

-Stephen

Hi Matt -

 

These are good points - I think the easiest would be to simply trigger the flow based on the Word document being saved to the doc library. This would avoid the need for any VBA since Word can natively save to SharePoint online. Flow can handle approval loops - but we definitely can do a better job of publicizing it :)

 

Also, regarding eSignatures, Flow has native integrations with DocuSign and HelloSign (with more providers coming), so it certainly could do that out-of-box. In this particular scenario I built a flow that handled it simply via email, but for a more robust process obviously DocuSign or HelloSign would be better.

 

Thanks,

-Stephen

Hi Juan,

 

Microsoft Flow is the successor to SharePoint Workflow so almost everything you can do with SP Workflow is possible with Microsoft Flow. A simple internal->external approval process like this one is certain in its wheelhouse. There are a few features from SP Workflow that may need custom code or a 3rd party solution, but for the most part that isn't the case any longer for solutions that would currently be done on SP workflow.

 

Thanks,

-Stephen

Hi Stephen,
Thank you for the detailed step by step with Flow for covering that scenario. While I agree that Flow is the successor to SharePoint Workflow, I would not say the same in regards of doing same thing with Flow and SP Workflow....a couple of examples from my side:
(1) AFAIK, Flow does not support yet working with SPO document sets
(2) There are some other actions available for SP Workflows that are not present in Flow...Of course, it's absolutely true that Flow provides more support to integrate with other services and we don't have this support in SP Workflows
(3) SP Workflows does not have any limitations in regards of the frequency and number of runs you can have when executing SP Workflows....with Flow you have some limits depending on your Office 365 plan.
(4) When talking about provisioning SPO sites, we don't have an easy way to provision Flows as part of the provisioning process...however, with SP Workflows, it's possible to write an extension for the PnP that will also provision SP Workflows

(5) The concept of Site Flow is not existing for the moment in SPO so there is not a replacement for SPO Site Workflows....of course, it's true that you can go to the Flow Admin Center and potentially do the same

That's are some of the differences that come to my mind...and I think it could be great to have a "mapping" resources (a document, a page in the Flow documentation) comparing item by item what you can do with SP Workfows and how this is supported in Flow.

Stephen, I bow down before you!  Thank you so much for taking the time to look at this in such detail and I'd be more than happy for you to blog about it and create a public template.  This scenario (draft, share for review, get approval, finalise) must be so common across organisations that I'd be amazed if the template weren't well used.

Thanks again and I look forward to seeing the finished product and trying it out with our contractors.

Thanks again Stephen - I'd be very interested to investigate DocuSign further if there is a native integration already built, but I'd definitely want the files stored in SharePoint rather than elsewhere.

Hi, I have published the template here: https://flow.microsoft.com/galleries/public/templates/ce9b6e9b147a49f58e5215e335285cd7 - hopefully you find it useful!

Thanks for the details Juan. For #1 and #2 you are correct that there are still a few actions that are not supported in Microsoft Flow. At this time we have the vast majority of actions but at the moment no special actions for SPO document sets.

 

For #3 - SharePoint Workflow does actually have limits, they are documented here: https://technet.microsoft.com/en-us/library/cc262787.aspx#Workflow - Microsoft Flow limits are much higher or not at all (for example, with SharePoint Workflow you're limited to 5k actions per day, but there is no such limitation in Flow). Additionally, because quotas for Micosoft Flow are aggregated at the tenant level the limits are very high (for example, if you have 1000 seats in your tenant then you get 2 million runs per month).

 

#4 and #5 is great feedback - we are actually working with the SharePoint team on developing solutions here. Thanks again! 

Ey Stephen, glad to help and thanks for the template :-)....I'm particularly interested about your thoughts on #4: is remote provisioning something that is in you backlog? I would like to know also what are your plans in regards of OnPremises integration between Flow and SharePoint OnPremise know we know that SharePoint workflows are a part where Microsoft is not going to heavily invest

Yes, we are working on flow provisioning right now - you can already package up flows and then deploy those packages for different sites, but we're working on documenting this so you can do it programmatically too. 

Chiming in. The first check I do when determining whether to use Flow or not is to assess how long the process needs to run. Flow is limited to 30days - which is fine for creation / provisioning actions, but tricky for automating monthly tasks - like invoice approval/payments/some project tasks....

 

https://flow.microsoft.com/en-us/documentation/limits-and-config/

 

You're right that a single flow cannot last more than 30 days, but you can have more than one flow work together that can support an arbitrary amount of time. For example, if you have an invoice approval process, you can have the flow end once the approval is sent and set the status of the item to pending. Then, you can have a separate workflow pick up when the status changes to approved.

Interesting, I was not aware about this limit in regards of how long a Flow can last...any plans to remove that limit?

We don't have any immediate plans to - it's not currently one of the top asks from customers - you can see the full list of features that have been asked for here: https://go.microsoft.com/fwlink/?LinkID=787474

Thanks Stephen!

super helpful!

In dilemma deciding between Workflow vs Flow. For the simple requirements I vote for native workflows, since the Flow option is, tied to individual user (instead of being part of site/sub-site), there are additional significant cost in future (source https://us.flow.microsoft.com/en-us/pricing/)

 

The Flow not being part of "Site/Sub-site" will not be part of "Site Template" and hence will be an object stored apart from site/sub-site making it harder to maintain the inventory from Administrator point of view.  The emails sent out in Flow option would have "sender" as individual user's email address.

 

So for regular activities which can be accomplished through "native workflow" I feel we should continue with that. Hopefully, there is no plans from MS to stop supporting the "native workflows" in near/long term future.

1 best response

Accepted Solutions
best response confirmed by Oz Oscroft (Iron Contributor)
Solution

Hello Oz,

 

This is a great scenario for Microsoft Flow. I'll walk you through how I built a flow that does essentially what you described below. It's a bit long, but it should cover every single bullet point that you outline. 

 

First, there's a SharePoint document library that you'll upload drafts to. This flow will trigger based on the draft being uploaded to that document library. You can use the When a file is created (properties only) trigger. 

trigger.png

I assume that you don't want to immediately start the approval process when you upload the draft. Instead, I've added a next step that lets you decide when the draft is ready to be sent to the official approver(s). We also can use this step to collect the email address of the consultant that the contract will be sent to (you could also use a custom column in the document library to enter that information - but for the purposes here it's easier to enter it once you kick off the approval section). action1.png

 

Now that the approval process is going to start, you'll need to add a Do until loop. This loop will continue until both the approver(s), and the consultant themselves, have approved the document. That will start out looking like this, once you add the approval step in:

 action2.png

 

For the first approval step inside the do until, you'll want to send a link to the final draft of the contract to the approvers. You can provide any number of approvers on the Assigned To line. You will also want to include a friendly message to the approvers indicating what they are approving. Filled out, that will look like this:action3.png

Now, there are two possibilities - either the approvers liked the contract draft and you can send it off to the vendor, or, they requested revisions and you want to be notified of those comments. To handle these two possibilities, you'll need a condition:condition.png

 

Inside the top condition box, on the left hand side you'll use the Add dynamic content option to pass in the Response from the approver. Let's look at each side of the condition one-at-a-time.

 

Starting with the If no side - we will send you an email requesting your revision. That email will also contain a button that you can click once you are done with the revisions to the contract so you can inform the Flow to restart the approval loop. ifno1.png

 This email, when it gets sent, will look something like this:

4.png

Now, let's look at the If yes side. First, we are going to get the latest word document content so we can send an attachment to the contractor. ifyes1.pngIdeally, you could get a link but since the contractors may not be in your Office 365 tenant, an attachment is likely the easiest way to accomplish this. Next, send an email to the contractor with the document attached:ifyes2.png

 This email, when its sent, will look something like this:6.pngNow, you'll need a second condition to check if the contractor is happy with the contract or not.condition2.png

If they select Revision needed then you'll need to send a similar mail as above to yourself to update the contract. Thus, in the If yes side you'll add this step:ifyes3.png

The flow will now wait for you to edit the word document, and then select the Revisions completed button in your email. When you select that button the approval process will loop to the top again and restart with the latest version of the document. You won't need anything in the If no side because no further revisions are required if the contractor approves.

 

You may have noticed that I skipped over the condition of the Do-until. This is because you need to add the actions inside first, before you can reference them in the Do-until condition. The condition will have two parts, because you want both your approver, and the contractor to approve. To build such a compound condition today you'll use the Edit in advanced mode button. In advanced mode you can use Microsoft Flow's excel-like syntax to build powerful boolean statements. In this case, that expression will look like:

@and(equals(body('Start_an_approval')?['response'], 'Approve'),equals(body('Send_approval_email_to_vendor')?['SelectedOption'], 'Approve'))

The exact values inside the quotes of the body() functions may vary depending on the names of the actions you give in your flow.

 

Now that you have completed the approval loop, the next step is to generate a PDF of the finalized contract and send it to the contractor for signature. First, download the finalized content of the word document:action4.png

In Microsoft Flow, we have a partner, Muhimbi, who provides functionality to generate PDFs from Word documents. If you haven't used Muhimbi before you can sign up for a free trial. That action is very simple, it takes the Word document content from the above step and the file name:action5.png

We will use the generated PDF to send the contract to the contractor for signature. Notice I have included the file name in the subject line, that's important for the next step. You can also provide additional instructions, for example:action6.png

Next, you will have the flow wait for the contractor to respond to the above email with an attachment. The reason that you must include the file name in the subject is because flow will specifically wait for the contractor to respond to that thread - if they happen to send you another email with an attachment in the meanwhile you don't want that being uploaded to your SharePoint. So, add on the When a new email arrives step and fill it out like below:trigger2.pngNotice the use of the file name in the Subject filter, as well as the fact that you're looking for emails that have attachments, and that you want to Include Attachments in the step.

 

The final step of the flow is to upload this attachment to your document library. Be sure to add (signed).pdf to the name of the file.action7.png

The most complicated part of this is email attachments can normally be a list of items -- but in this case you just want the first email attachment. You can use another flow expression to get this attachment by itself. That's what the pink value is above in the File content field. The full expression would look like this:

base64ToBinary(first(first(body('Wait_for_vendor_response')['value'])['Attachments'])['ContentBytes'])

Now you're almost done. However, there is one more change that needs to happen. Because the above attachment is being uploaded to the same document library you're monitoring -- this whole process will also be triggered on the signed PDFs being uploaded. This isn't what you want, so you should go back to the top of the flow, and add one more condition:condition3.png

In the condition, we check to see if the Name ends with (signed). If it does then we immediately terminate the flow. This will prevent you from getting double approval flows. You could also accomplish something similar by having a separate document library for your signed PDF's. In the end the full flow looks like this:fullflow.png

 

I hope that this was useful for you to see how this could be done in Microsoft Flow. If you don't mind, I would like to blog about this scenario on the flow blog because I think it's a very interesting one (let me know if that's okay!). I can also make a template out of this flow if you're okay with it being public -- then you can just use that template and you won't have to configure it all yourself based on these instructions :)

 

Let me know what feedback you have, and I would love to hear if you find this meets your needs or not.

 

 

 

Thank you,

-Stephen

View solution in original post