Power Automate SharePoint Get Column Changes

preview_player
Показать описание
#PowerAutomate #SharePoint

With the Get Changes Action in Power Automate we can determine if a column has changed in your SharePoint list or library. But how do we determine what the value was before it changed? Learn how you can leverage the SharePoint HTTP Action in Power Automate to get column changes in your list item using the version history. I'll walk you through all the steps needed to run a flow when an item is modified in SharePoint, tell if a field has changed and get it's previous and current value.

⚠ Code Used

Expression for SharePoint HTTP Action URI Property:
_api/web/lists/getByTitle('Asset manager')/items(@{triggerOutputs()?['body/ID']})/versions(@{outputs('Get_changes_for_an_item_or_a_file_(properties_only)')?['body/SinceVersionId']
})

Expression used to get the previous value from the HTTP request: body('Send_an_HTTP_request_to_SharePoint')['d']['Status']

🔗 Links 🔗

Table of Contents:
00:00 - Intro
00:50 - Use Case
01:35 - Setting up the Flow Trigger
02:20 - Setting up the Get Changes Action
03:40 - Enabling Versioning
04:21 - Setting up the HTTP Action
07:35 - Check if a field has changed
08:28 - Getting the previous value
11:45 - Testing and wrap up
Рекомендации по теме
Комментарии
Автор

Wow! You posted this at literally the perfect time. I have been working on trying to figure out something like this all week and almost gave up today. Thank you!

randywade
Автор

Thanks April, this is exactly what I was looking for!

Something I found. I copied your code for the HTTP expression for Send an HTTP Request to Sharepoint, but then I replaced the version with the SinceVersionID dynamic value. What I caught was that your code referenced SinceVersionID and the dynamic value referenced SinceVersionLabel. The Flow kept failing at that step, but once I pasted your code in everything worked.

Thank you so much for this video!

stretch
Автор

A year later this is super helpful! Standard notification rules don't apply to columns with multiple text, so this video is the life saver, thanks a million!

swaidmckey
Автор

Hi There! Amazing Video!! I wanted to know if the Condition control can be modified to only send an email when a status change to a specific item for example when status change from Pending to process, but not send an email when is changed from processed to closed?

wealthylatino
Автор

Excellent as always. Clear, well paced, instruction on using some of the intermediate functions of powerautomate. Even a beginner can follow April's logic and actions to find a solution for themselves.

claregreenlaw
Автор

Seriously thank you so much for taking the time to publish something like this, it is greatly appreciated.

skydivealdroid
Автор

Unbelievably helpful. I'm in awe of the way you present these so clearly and succinctly. Thank you 🙏🏻

AutismBucks
Автор

Hi April, first of all also from me THANK YOU, as you are the only person I have found (and I have looked long and hard for this) who has put this in understandable terms. There are many comments here that reference errors that people ran into as well as mentions that people found was around this. Since it took me quite a while to figure this out I thought I'd post the solution (and maybe you could incorporate it into an updated version of your video?).
The error is caused by the part of the URI after "versions". I tried following along your steps in the video and tried everything I could think of (even using it as an expression etc) - without success. I also tried copying your code and replacing the parts in the brackets with the items that you show in the video, again without success. Then I noticed that whenever I used the dynamic content buttons the result looked different from the results you show in your video. It didn't say "body/Since Version...", rather just "Since Version ...". So I decided to again copy your code, but this time I just altered the SharePoint list name and the ID (via Dynamic Content). I just left the rest of the code untouched. And voila, it showed up just as it does in the video and worked perfectly!
Again, I don't understand why this is so, but thought I might save other users some hassle :-)

lorde
Автор

Thanks for the detailed explanation! Is there a way to check if a new version of a file within the document library has been uploaded and trigger an email based of that event?

adnanqureshi
Автор

Thank you! this is what I want. But I met a problem with the error msg "Input string was not in a correct format.
clientRequestId:, i type the code according on the viedo but cannot work...

sunjerry
Автор

Omg!! You’re amazing! I have been looking for this tutorial how to get the previous values. Thank you so much!! This is a big help! Thank you again!

princessamante
Автор

This video really helps, although you might get an error. I solve it! Just like others mentioned, I get an error on step "Send an HTTP request to SharePoint". I notice that in video 9:02, the content of your URL ends with "versions(2048)", not versions(4.0). I check the raw outputs of step "Get changes for an item or a file" and found the number 2048 is more likely from "SinceVersionId". Then I check my dynamic content on step "Send an HTTP request to SharePoint", and it shows "body/SinceVersionLabel". I modify it to "body/SinceVersionID", then this step passed successfully. After this step passed, the "Compose" step failed, but now I know how to find the error, just go to check the raw output of your previous steps, you may find some column names different from what you think. e.g. ['d']['a_Status'] failed, but changed it to['d']['a_x005fStatus'] passed.

ShihChiWang
Автор

Much better/neater solution than having a 'Previous Status' field that was often suggested to compare to

riccol
Автор

Oh my gosh you are heaven sent! I’ve watched too many videos attempting provide the results you just gave me, so THANK YOU 🙌. I do have a follow up question…If I wanted a different email with different recipients based on the status to get sent, how do you build that condition? Ex: If status=Recieved, email these people or if status=approved the email these people instead? Thank you for what you do!

tiahphillips
Автор

Hi April!
Thank you for this.

How can I get the "Current Status" from the HTTP Request.
I want to make a condition, that I only want to "send an e-mail" if the Current status = X

asam
Автор

Great video. Thank you Professor. Helped me solve a business problem. Wanted to share a tip, in my eagerness to avoid writing a formatdate expression. Used "convert time zone" tool for "Date Modified" and keep source and destination time zone the same, then I simply selected the way I wanted the date to look like in format string.

radiosonicfan
Автор

Thanks a lot April for producing and posting this! Very helpful!!

eduardoogassawara
Автор

This is really awesome. I was tasked with this and had no idea how to capture the changes. There were a few other articles out there but had SO many more steps- this is streamlined to do what it needs to without having the flow be too many steps. Brilliant ! Thank You for Sharing this

paulgemme
Автор

Great help thank you very much. BTW, is it possible if the status is "WIP" to send an email to one person but if the status is "Done" to someone else? I've tried but it hasn't worked for me.
(Send email to different people according to the status)
Thank you

hectoraleman
Автор

April, many thanks for this extremely useful and brilliantly explained video. I have tried this and got it working so you have a new subscriber and I look forward to watching more of your videos...Ken

wken