Trigger Power Automate Flow on SharePoint Field Change

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello in this video we're going to take a look at a very important concept as it relates to SharePoint lists and power automate workflow specifically we're going to look at how you can listen for a specific field changing in your SharePoint list it's very common that we have workflows that are responding to any time an item is updated in SharePoint but that doesn't really factor in situations where we are listening just for a specific change for our example we're going to look at when somebody needs to do a approval request or you might for example want to trigger an email when status changes to complete and so we want to be able to do this by modifying the power automate workflow to check for some specific conditions so we can isolate just for that field change specifically so let's go ahead and jump in [Music] thank you foreign here I am back in SharePoint online and to begin this exercise what we're going to do is create a very simple list which is just going to be enough to demonstrate the concept that we're after so you can follow along and do the same steps that I'm going to show in this video so I'm going to make a new list and I'm going to make this be called approval requests and that's it I'll show it my site navigation sure that's fine for now and then what I'm going to do is just add one column and I'm going to make it a yes no column and then hit next and we'll just call this request approval and that'll be a yes no defaulting to no that is all that I'm going to need for the SharePoint list the idea here is we're going to have some names of projects say apples project bananas project Jerry's project okay so I have a few records to exit grid View and we're gonna have this request approval which is a check box and when this is gets checked I want to kick off my workflow but only when that specific field changes not when anything else in the record might change now in SharePoint there's an important concept that you want to understand that relates to what we're going to do and that has to do with versioning and by default in SharePoint you're going to have item versioning it's keeping track of changes every single time that record gets updated that is a version and by default that's set to 50 versions with SharePoint online so you will not have to make any changes to this but you might go ahead and examine this in the list settings as I'm showing here so we can leave that exactly as is just something to be aware of in the context of what I'm getting ready to show so that's all that we need to do in SharePoint now we're ready to look at the power automate aspect of this so we're going to go ahead and create a new flow and I'll just click new flow this will be an automated cloudflow and I'm going to call this send chat message when approval request okay and then what we're interested in is when the item is modified okay so when an item or file is modified that's the type of flow that we're going to do let that open up and then we need to browse to the list that we just created so I'm going to go to my site here and I'm going to find my new list which is approval requests and then we're going to because I always like to expand the options just to make sure I see everything and we're going to start with the first key concept as it relates to detecting for when a specific field changed normally when we do this modify event we don't add any conditions but you have the ability through the settings to add trigger conditions on this field and what that does is tell us additional parameters that control whether or not this is going to float since instead of always running which is the default condition we can put conditions on that so what I'm going to do is add in a special trigger condition here to get what I want um so we need to have some special syntax I'm going to put this in the footer under the video this is the one part we're going to put in a little bit of a snippet of code but generally it's pretty eager easy to understand so you can copy and paste from the snippet so what I need here is at sign equals and then you need to type in trigger body just as you see me showing right here and then question mark and then in square brackets and then two single quotes I need the name of the field so this goes back to SharePoint I called my field request approval with no spaces you could call your field what you want it does need a reference the internal name and SharePoint so you'll notice I didn't put a space in my field name that was just to make things easier so I have to put in extra code so I'm going to reference that it's a request approval and then I can put a comma and then it needs to know what value I'm looking for so I'm interested in this one it's true and I literally just type true here and then I can close that and that's what I need for my trigger condition and I will click done I do want to reference something this is also linked in the video there's an excellent guide on trigger conditions and SharePoint in spguides.com this is a site maintained by a friend of mine BJ who is excellent in all kinds of SharePoint examples on the web he runs a couple of different sites enjoys sharepoint.com and spguides.com I'll put a link to this particular page he is really excellent information about how to set these up so let's go back over here so the next thing we're going to do which is special to our circumstance is we need to get the changes there's a particular option that we have where I can to get changes for an item okay get changes for an item or a file properties only we want to select that and then once again we need to browse to that same site and list so my list was called approval request there it is then we just simply pass along the ID I don't have any other options to choose from so that one's simple and then there's a couple of special arguments you put in here we only care about comparing against the last version of the file preceding this one this is a bit difficult to explain but I will tell you you just need to type the word trigger and when you do there's two special options that are available to you which you want to take advantage of so if you've got trigger Windows start token trigger window and token for synths you want to use trigger Windows start token and then until trigger wiggo end token all you have to remember is Type in the word trigger under the dynamic content it's going to find it for you just make sure to do that each time okay now this flow is aware of previous version information on this record so the next thing I'm going to do is a regular condition block and we're going to check what we want to know is whether this field request approval is changed to yes so we already filtered the flow so it's only going to run when the values yes now we're going to ensure that it actually was a change in other words in this case it would have had to be no as a preceding value for the record so we have some special properties now available to us it says has column change these are available to us specifically as a result of the preceding flow block get changes for an item it gives us this additional properties so here's the has column change request approval that's going to return a Boolean result so it will either be true or false and I want to make sure that I do my next part of the flow only in the case that it changed it changed so I simply will go to the expression I'm going to type the word true and that will call up this block and can see that in there and now I will only execute the rest of my flow in the case that this field changed not only that it's true but that it was changed from unchecked to check false to True okay and just to demonstrate the rest of this we're going to add in fun one which is the flow bot messages which I featured in another video which you can find on my channel preceding this video so I'm going to use the option post message in chat that's a special Microsoft teams option and we're going to let flobot send a message so we're going to say chat with flowbot and this is going to go to me there I am and I'll make my message super simple um approval request for and then let's just go ahead and put in the title of the record so there it is that's it it's going to ping me with the message there's one additional step I'm going to do here now you don't necessarily need this step in my case I want that checkbox to reset I wanted to go back to its original state so that it's set up to trigger again I don't want it to stay checked now if you were doing this and you're doing something like checking for when a value changed like a status to complete you don't need to reset that you can catch just when it changes to complete it won't fire again in my case I want to reset my field so this is an optional part of it so in my case what I want to do is update this item and the item I want to update of course is um from the same site so a lot of repetition and power automation sometimes I just need to select the same things again so I'm going to pick my same list again um it's um approval requests the ID of course that's the ID of when an item is modified coming from the very top of the flow and then title is required so I need to just pass along the title value that we already have so um I just find title again and then request to prove I'm resetting that back to no okay so that's correct let me save that let me double check I have another um flow that I created previous I'm going to make sure my syntax precisely correct just to make sure that we're good so I did this on this one let me go to the settings that looks to match to me so I'll go ahead and stick with this let's go back to SharePoint and let's fire it up okay I can even just use the grid view so it's just this simple I checked the Box exit grid view now SharePoint record has gone to true and now I can go back to my home page for this flow and I can wait for it execute I tend to think of this like waiting for the bus um we don't know precisely when it's going to respond but at some point this request can be picked up so we can just sit patiently on our page um the delay varies a little bit um it can be you know anywhere between you know 30 seconds a minute but we can kind of just sit on this page and refresh and eventually we'll see it pick up the request so a key part of this that's important is where being as efficient as we possibly can by using that condition on the original trigger ensuring that this flow is not going to use up unnecessary runs it's not just going to execute every single time that SharePoint list record is updated it's only going to run this flow specifically when that field has the value that we set that's a really key part of this so um make sure you include that condition and then of course the other key part of it is the change to the property so that's a really key thing to consider okay so there's my flow running Bing there's my power automate message so I just got a message in power automate I'll move that over and there it is approval request for Apple's project very nice all right let's get this out of the way and what you're also going to notice is if I go back to SharePoint and refresh the page my checkbox just disappeared so it reset me back to the original state and that's exactly what we wanted um so this is an important concept because you can use this to trigger any kind of a flow so everything you see past that if condition on the flow it could be anything so instead of having to do say for a selected item trigger power automate or if you want to trigger this under other circumstances now we're able to precisely trigger the flow based on the specific case that one of the fields in our SharePoint list changes so you're being as efficient as you possibly can that's all I wanted to show you of course that was a silly use case we only had two fields in the list but that was by Design I wanted to make sure that you can get out of the blocks by just following the exact example that I gave again I want to emphasize the link under the video is very useful to BJ's site on um you know all those various different examples of trigger conditions in our case we were checking for a true false field and more often more often the case you're checking for a text value or you may have a numeric value so you use different code Snippets for those trigger conditions but that's really a very key part of it um so if you've ever wondered about that how do I check for the case where a specific field was updated to us a value that you're looking for this is the best and most efficient way that you can go about doing that with power automate so it's very important for you to be comfortable with the approach that I demonstrated because this is something you can repeat and use over and over again and be efficient and specific and targeting those changes and not just doing it every time that list item is updated and simply doing an if condition to check so I hope you enjoyed that I hope you found that useful and you're able to take advantage and make your SharePoint list related power automate flows work more efficiently and you can catch those changes or use the trigger like we have in this case let your user have a check box where they can trigger a flow directly from your SharePoint list form just by selecting a particular field and good luck
Info
Channel: SharePoint Smart
Views: 4,158
Rating: undefined out of 5
Keywords: SharePoint, Power Automate, Power Apps, Microsoft 365
Id: INxRqXTVvVw
Channel Id: undefined
Length: 18min 4sec (1084 seconds)
Published: Thu May 18 2023
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.