Locked lesson.
About this lesson
Create an approval workflow that is automatically triggered when a new file is added to the document library.
Exercise files
Download this lesson’s related exercise files.
6.03 automated-workflows - Exercise.docx60.9 KB 6.03 automated-workflows - Exercise solution.docx
61.1 KB
Quick reference
Automated Workflows
In this lesson, we are going to create an approval workflow that is triggered automatically when a new document is uploaded or created in the SharePoint document library.
When to use
Create an automated workflow whenever you want an action to trigger the workflow.
Instructions
Create an Automated Workflow
To create an automated workflow, we need to open Power Automate.
- Go to the office.com home page.
- Click the App launcher.
- Open Power Automate.
- Click My Flows.
Automatic workflows are triggered by an action. We want to send a document for approval when its uploaded to the document library.
- Click Create.
- Select Automated cloud flow.
- Give the flow a name.
We need to select a trigger for the flow. There are lots of triggers to choose from in Power Automate. Our trigger is the process of uploading or creating a new document in the SharePoint document library. Narrow down the list of triggers by only showing triggers related to SharePoint
- Type 'Sharepoint' into the search field.
- Select When a file is created in a folder.
- Click Create.
Define the properties for the trigger.
- Click the drop-down arrow and select the correct SharePoint site from the list. This is the site we are currently working in.
- Specify the folder where the files will be uploaded to.
- Click folder icon and select Shared Documents.
Now we have created the trigger, we need to create the action. So, when a file is uploaded to the document library, we want to start the approval process.
- Click New step.
- Click on the Actions tab.
- Narrow down the list of actions by typing 'approvals' into the search field.
- Select Start and wait for an approval.
- Click the drop-down arrow.
- Select the Approval type: Approve/Reject - Everyone must approve.
- Add a title for the approval. This is the title that will appear in the email notification.
- Enter the names of the approvers.
The other fields aren't mandatory. Remember, we could carry on going adding more steps to make the workflow more complex.
Testing the Workflow
- Click Test in the top right-hand corner.
- Select Manually.
- Click Test.
- Go back to SharePoint and upload a file to the document library OR create a new document.
- This will trigger the workflow.
- Go back to Power Automate.
The first step will show with a green tick as it's been completed. However, the workflow is waiting for the document to be approved by the approvers.
- Open Outlook.
- Open the email notification and select Approve. Add comments if required.
- Click Submit.
The workflow is now complete.
Login to download- 00:03 In the previous lesson,
- 00:05 we saw how we can create a approval workflow that's manually triggered.
- 00:10 And I'd like to move that idea along a bit by showing you a very similar example, but
- 00:15 I want to show you how you can automatically trigger workflows.
- 00:18 And what you also saw in the previous lesson is that in order to create
- 00:22 our workflows, we need to harness the power of another application
- 00:27 in Microsoft 365 called Power Automate.
- 00:30 So we're going to start this time by opening up the Power Automate app.
- 00:36 So let's jump back across to our Microsoft Office homepage.
- 00:39 And if I click the app launcher, you'll see in my list of available
- 00:43 applications I have one called Power Automate.
- 00:47 So let's click to open.
- 00:48 And in the menu on the left hand side, I'm going to select My Flows.
- 00:53 And what you're seeing there is the workflow that we created in the last
- 00:57 lesson.
- 00:58 I also have another one underneath which is a very similar workflow that I created
- 01:02 two weeks ago.
- 01:02 But this one here is the one that's most recent.
- 01:07 Now, when we're creating an automated workflow,
- 01:10 it means that that workflow is triggered automatically by an action.
- 01:13 And the example that we're going to use in this lesson is pretty much the same.
- 01:19 I still want to send a document for approval, but
- 01:22 I want that approval to be triggered automatically.
- 01:26 And the trigger is going to be when I upload a document to the document library.
- 01:32 So when I upload or create a document in a document library in SharePoint,
- 01:37 I want to trigger the approval workflow.
- 01:40 So the creation of a document is essentially the trigger and
- 01:44 the approval workflow is the action.
- 01:46 So for this, I need to create a brand new workflow.
- 01:50 So from my menu on the left hand side, let's select Create.
- 01:53 And you can see that I have three different ways that I can make a flow.
- 01:59 I can start from a blank, start from a template,
- 02:01 which is pretty much what we did in the last lesson, or start from a connector.
- 02:07 Now, for this one, I'm going to start from a blank, and
- 02:10 I want to create an automated cloud flow.
- 02:12 So the first thing I need to do here is give my flow a name.
- 02:16 Now, you can take the time and make this more meaningful.
- 02:18 I'm just going to call mine Doc for Approval.
- 02:21 And I then need to choose my flow's trigger.
- 02:24 Now, remember, the trigger for
- 02:26 this flow is that whenever there is a new file added, uploaded or
- 02:30 created in the document library, that file needs to go through the approval process.
- 02:36 And you'll see here I have a list of all of the different triggers that I
- 02:40 might want to use.
- 02:42 Now, to narrow this list down, because is quite long, I'm going to search for
- 02:46 just the ones that are related to SharePoint.
- 02:48 And if I take a look through this list, I can see the top one here says when a file
- 02:53 is created in a folder, and that is exactly the trigger that I'm looking for.
- 02:58 So let's select the trigger and click on Create.
- 03:02 Now I get to define some more properties for this trigger.
- 03:06 The first thing I need to do is choose the site address, and this is very important.
- 03:10 If you click the drop down,
- 03:11 it's going to show you all of your SharePoint team sites.
- 03:14 Now, the SharePoint team site that we're working in is this one just here,
- 03:18 Microsoft 365 Rollout.
- 03:20 I then need to specify the folder where the files are going to be uploaded
- 03:25 to in order to kick off that workflow.
- 03:29 So for me, they're going to be uploaded into the document library.
- 03:33 So let's click on the folder icon, and it's actually Shared Documents.
- 03:38 That essentially means document library in this case.
- 03:41 So that is my trigger.
- 03:43 So once a new file has been uploaded to the document library,
- 03:47 what do I want the flow to do?
- 03:49 Well, I want that document to go through the approval process.
- 03:53 So let's add a new step.
- 03:56 And from here, I can add my action.
- 03:57 And if you take a look just below, I'm in the Actions list.
- 04:01 I could also add another trigger in here if I wanted to.
- 04:05 Now again, this actions list is very, very long.
- 04:08 So I'm going to search for all of the actions that are related to approvals.
- 04:13 So if we type in approvals, I can see a list of those actions below.
- 04:20 So what do I want this action to do?
- 04:22 Well, this top option looks like the one I want.
- 04:25 I want it to start the approval process, but I want it to wait for an approval.
- 04:31 So let's select Start and wait for an approval.
- 04:34 Now, what is my approval type?
- 04:36 Well, let's click the drop down and take a look at our options.
- 04:39 Well, I can choose to approve or reject where everyone must approve,
- 04:43 approve or reject, first to respond, or I can choose some custom responses.
- 04:48 Now, I'm not going to get too fancy here, I just want to select this first one,
- 04:51 approve or reject.
- 04:52 Everybody that I send this to,
- 04:54 all of the approvers must approve the file before it's finally approved.
- 04:59 And now I can define more parameters.
- 05:03 So again, what is the title for this approval?
- 05:05 What are people going to see when they receive this email or this notification?
- 05:10 But again, I'm going to keep it simple, Doc for Approval.
- 05:13 And then I can specify who this approval needs to go to, who are the approvers?
- 05:19 Once again, you can type more than one name in here.
- 05:21 Because I am one person, I am also going to be the approver, once more.
- 05:25 And then I have some other fields I could complete down here, but
- 05:29 notice that these aren't mandatory because they don't have an asterisk next to them.
- 05:34 So I'm going to leave these blank and click Save.
- 05:37 Now, I could carry on going adding new steps, but
- 05:40 I don't want to go too deep into this.
- 05:42 Otherwise we're going to start to go off on a tangent into the inner workings of
- 05:46 Power Automate.
- 05:47 But suffice it to say you can create very complex workflows through this
- 05:51 application.
- 05:52 Now, what I want to do here is I want to test this workflow.
- 05:54 And if you take a look in the top right hand corner,
- 05:57 you can see that we have a test link.
- 05:59 So let's click Test.
- 06:01 I'm going to say I want to manually test this workflow.
- 06:08 And what you'll notice is that now that I've done that I get a message in
- 06:12 the top bar that says to see it work now,
- 06:14 add a file to the SharePoint folder you selected.
- 06:17 Now, remember, adding a file is the trigger for this flow.
- 06:21 So let's jump back to our document library.
- 06:24 And just to make this really quick, I'm just going to create or
- 06:27 add a simple Word document.
- 06:29 So let's just put Hello World in here.
- 06:31 I'm going to wait until that says saved.
- 06:36 You can see that I'm getting a notification from Teams saying that
- 06:40 a request has been sent because it's recognized that a new file has been added
- 06:44 to this folder.
- 06:46 And there it is there, Document.docx.
- 06:49 So this simple process of creating a new file and
- 06:52 adding it to the document library has triggered the approval workflow.
- 06:56 Let's go back to Power Automate and take a look at what's happened.
- 07:00 We now have a green tick, which tells me the file has been created in a folder.
- 07:04 It's now moved on to the next stage of the workflow, it's going to sit there and
- 07:09 wait for an approval.
- 07:11 And you can see that because I am the approver, I've just got a notification
- 07:15 from Outlook letting me know that I have a file sitting there waiting to be approved.
- 07:20 So if I jump across to Outlook, there it is at the top.
- 07:24 And I'm going to say Approve, type in the comment of Approved, and submit that.
- 07:29 And then I should find in a moment that this workflow will continue and
- 07:34 complete successfully, which it has done.
- 07:37 If I now jump back into My Flows, I can see my new flow sitting at the top there.
- 07:43 And if I click on this, I can see the 28-day run history and
- 07:47 I can see that that was successful.
- 07:49 So that is how you create an automatically triggered workflow in SharePoint and
- 07:53 Power Automate.
Lesson notes are only available for subscribers.