cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
hsparg008
Frequent Visitor

Access Past Entry in SharePoint List and Compare with Current Entry

I'm trying to create a flow that sends email notifications when the status of a test room has changed. The test room status is entered into a SharePoint list via a Nintex form. I want to loop through past entries, to find the entry with the same test room name and the most recent date. Then, I want to compare the statuses from the current entry and the stored past entry. If they're different, I want to trigger the email.

 

Is there a way to do this? I have a screenshot of my list for reference.

hsparg008_0-1655997127101.png

 

2 ACCEPTED SOLUTIONS

Accepted Solutions
eliotcole
Super User
Super User

You shouldn't need to loop, here, just perform a SharePoint Get items action, and:

  1. filter on the status that you want is not equal to (ne) the status defined earlier
  2. order by create date (or modified whichever is most relevant here
  3. top count it by 1

 

Then you can even take the details from that single entry without looping (but the loop won't be onerous if this is too much, it should be 1 loop, maximum) by referencing entry [0] in the resultant array from the Get items.

 

Also, you'd be wise to put an error check stage in after the Get items, to check that it has at least produced 1 entry, because if not, something's wrong.

 

You don't need to have this mapped out for you, @hsparg008, just run some test flow runs with a Get items action and the filter conditions, and you'll get it. 👍

View solution in original post

Yes, I've found this article helpful on sorting: https://tomriha.com/how-to-order-sharepoint-items-returned-by-get-items-in-power-automate/

It's what @eliotcole was referring to when ordering the list.

Good luck!

View solution in original post

4 REPLIES 4
eliotcole
Super User
Super User

You shouldn't need to loop, here, just perform a SharePoint Get items action, and:

  1. filter on the status that you want is not equal to (ne) the status defined earlier
  2. order by create date (or modified whichever is most relevant here
  3. top count it by 1

 

Then you can even take the details from that single entry without looping (but the loop won't be onerous if this is too much, it should be 1 loop, maximum) by referencing entry [0] in the resultant array from the Get items.

 

Also, you'd be wise to put an error check stage in after the Get items, to check that it has at least produced 1 entry, because if not, something's wrong.

 

You don't need to have this mapped out for you, @hsparg008, just run some test flow runs with a Get items action and the filter conditions, and you'll get it. 👍

Thank you! I will try this. Is there a way to sort a SP list in Power Automate?

Yes, I've found this article helpful on sorting: https://tomriha.com/how-to-order-sharepoint-items-returned-by-get-items-in-power-automate/

It's what @eliotcole was referring to when ordering the list.

Good luck!

Thank you! 

Helpful resources

Announcements
Register for a Free Workshop.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Users online (2,526)