Power Automate Flow: Use conditional logic to send email notifications and update sharepoint list (1 Viewer)

Isaac

Lifelong Learner
Local time
Yesterday, 18:26
Joined
Mar 14, 2017
Messages
5,052
Again, adding to start out the content here. As a beginner in this area I have continued to use Flows to automate the retrieval of records, update of records, and sending email notifications. There is a basic step with operation Send an Email Notification (v3), which comes from Microsoft, external to the user, and has an ugly Unsubscribe link. Then there is a Send an Email from a Shared Mailbox (v2) operation which is much nicer, as the title indicates, and loses the unsubscribe link from Microsoft.

My goal was to do the following:

  1. Retrieve a management-configurable Sharepoint list record (Configurations list) which would tell me:
    1. The due date of a particular task description
    2. The # of days prior to the due date that should cause the notification to go out, if a record in a different list (ProgressTracker) is missing a datestamp for the task and a datestamp for the notification sent
    3. The subject of the notification email
    4. The body of the notification email
  2. Determine whether or not (the Due Date minus Today) was less than (the # of days prior to due date to notify)
  3. If #2 was True, then:
    1. If the record in ProgressTracker was missing a datestamp for the task AND a datestamp for the notification, then send the notification and update the ProgressTracker column (for notification sent) accordingly. Email address would be contained in ProgressTracker
I was faced with a few possible ways of doing this.
  • Retrieve only items from ProgressTracker missing the datestamp for the task completion and missing the datestamp for the notification was sent, then use a condition to determine if we are currently 'in range' and send the notification to all items retrieved
  • Retrieve all items from ProgressTracker, then loop through them and determine which ones need the notification - and whether we are in range in the first place
  • A combination of the above
Since I have found the ODATA Filter (part of the configuration of a sharepoint list GetItems operation) to be extremely difficult to use, I decided to GetItems > all items, and then build my conditions one at a time (connected by AND) inside an ApplyToEach operation which comes after the GetItems operation.

The final product is pictured here - hopefully the pics come out in order. Hope this helps someone someday!
Clearly, retrieving only the filtered items would be better from an optimization standpoint, and in fact, doing all of this only if we are "in range" FIRST would have been better, but for now, this is what I created and works. If/when I successfully create my AND() statement for the ODATA filter expression, I might update this post accordingly.

Flow_1_Recurrence.jpg

Flow_2_GetItem.jpg

Flow_3_variable for due date.jpg

Flow_4_variable for email subject.jpg

Flow_5_variable for email body.jpg

Flow_6_variable for days before due date to notify.jpg

Flow_7_Get all items to potentially update.jpg

Flow_8_Apply to each - send email and update item.jpg


Flow_8_Apply to each_1 (send email).jpg

Flow_8_Apply to each_2 (update item).jpg
 

Users who are viewing this thread

Top Bottom
日韩精品亚洲专区在线影院