web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Setup the flow that sc...
Power Automate
Answered

Setup the flow that scans azure sql table and compares the dates for records...

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Good morning,

We do have a Maintenance request app that records all request in the azure table. Not many tickets yet, but its growing.

 

Is there a way to create a custom flow that runs 24/7 or on schedule and scans the existing azure SQL table for the date, if the record has True value in the 'Open'  field and if the 'Expected Close date' field  lets say two weeks or more passed todays date then send an email to certain individuals? 

 

Is it possible?

 

Thank you.

 

 

Categories:
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @ajs1,

     

    Could you please share a bit more about your Azure SQL table?
    I have created an Azure SQL table on my side and its data structure as below:

    id                                           int (primary key)

    RequestName                     varchar(255)

    OpenStatus                         varchar(5)

    Expected_Close_Date       date

    RequestorEmail                  varchar(255)      (Email addresses of the requestor)

     

    I have made a test on my side and please take a try with following workaround:

    • Choose a proper trigger, here I use Recurrence trigger, the flow would run at 09:00 every day.
    • Add “Get rows” action, specify Table name.
    • Add a “Apply to each”, Input parameter set to output of “Get rows” action.
    • Within “Apply to each”, add a Condition, click “Edit in advanced mode”, type the following formula:
    @and(equals(items('Apply_to_each')?['OpenStatus'], 'True'),lessOrEquals(items('Apply_to_each')?['Expected_Close_Date'], formatDateTime(addDays(utcNow(), -14), 'yyyy-MM-dd')))
    • Within “If/yes” branch of Condition, add “Send an email” action, To field set to RequestorEmail content of “Get rows” action.

    Image reference:2.JPG

     

    3.JPG

    The flow works successfully as below:4.JPG

     

    Best regards,

    Kris

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Genious! Thank you! Works awesome!

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hello,

     

    Is there a way, once the condition is true, stop executing (exit Apply to each  loop) and send just one email?

     

    Currently the database have quite a few overdue items and its sending mltiple emails.

     

    Thank you.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 321 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 244

#3
Henil Profile Picture

Henil 102

Last 30 days Overall leaderboard