cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
roberts
Helper II
Helper II

Send email when SharePoint List item is modified

Hi

I am trying to create a flow to send an email after a sharepoint list entry has been modified.

 

The idea is this

  1. A user creates a new item in my SharePoint list -> They receive a confirmation email (working)
  2. A different user then goes into the same SharePoint list to update a specific column with comments which will then trigger an email back to the person who created the entry.

I am having difficulty getting the email to send when sharepoint list is modified.

I tried using a control to compare "modified date/time" to "created date/time" and it works and sends the email. However, it sends an email for every item in the list not just the newly modified one. 

 

flow1.PNG

 

So i then thought, i would add a Compose to pull the current date and add that as another "or" condition

 

formatDateTime(utcNow(),'MM/dd hh:mm tt')

 

flowerror - Copy.PNG

 

This doesn't work either as the date/time is incorrect. Example the current Date is 4/232020 @ 8:35pm yet the output shows 4/24 @ 12:33 AM

 

flowerror.PNG

1 ACCEPTED SOLUTION

Accepted Solutions
ScottShearer
Super User III
Super User III

@roberts 

You should not be relying on the created/modified times to determine if an item is new or has been modified - it is not a reliable indicator.

Here is a link to a blog post that I wrote that explains a very simple solution based on versioning.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

6 REPLIES 6
ScottShearer
Super User III
Super User III

@roberts 

You should not be relying on the created/modified times to determine if an item is new or has been modified - it is not a reliable indicator.

Here is a link to a blog post that I wrote that explains a very simple solution based on versioning.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

View solution in original post

Thanks Scott

 

i will try this out today and report back

one question though, when you turn on version settings, it asks for a number of versions to set “1 to 50000” what is the best number to enter?

@roberts 

On the number of versions, there is no right or wrong answer to that.  I always like to keep at least 10 versions - I use it in case an end user says "I don't know how that happened...".  The solution that I provided will work even if you have the number of versions set to 1.

Also, if you copy and paste the code, remember to replace the single quotes around VersionNumber otherwise it will fail.

 

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Thanks Scott

 

I set Version settings to 2

 

I updated my flow but I received 8 emails (because there are 8 entries in the list) So every time someone modifies and entry i now get an email for all items in the list instead of the recent change only. Is it because i have the "get tiems" ? I have this to lookup the original submitters email and the information from the list submission to return in the email

 

1.PNGerror.PNG

so just to update, i thought i had this resolved but i don't.

 

@ScottShearer is on the the right flow. I do get an email once someone modifies the shareppoint list item. The issue is when someone submits a new item I now get 2 emails. 1st email is part of a flow to email when a new item is added. And now i get a 2nd email as the version date i guess is seconds different. Or it might also be when a user goes to open the item to view its detials

@roberts 

What is the purpose of the Get items action?  If the purpose is to lookup email addresses from a second list, then try the following:

  1. Initialize a string variable
  2. Inside of the loop append the email address and a semicolon to the string
  3. Move the send an email action outside of the loop
  4. Use the string variable for the To: email address

In my example below, I am using the Created By column - you will use your person or group column

EmailVar.jpg

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott

Helpful resources

Announcements
Process Advisor

Introducing Process Advisor

Check out the new Process Advisor community forum board!

MPA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

V3_PVA CAmpaign Carousel.png

Community Challenge - Giveaways!

Participate in the Power Virtual Agents Community Challenge

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (2,116)