cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ajs1
Level: Powered On

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

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.

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

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

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 Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

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

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 Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

ajs1
Level: Powered On

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

Genious! Thank you! Works awesome!

ajs1
Level: Powered On

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

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.

Helpful resources

Announcements
firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

Incoming: New and improved badges!

Look out for new contribution recognition badges coming SOON!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,487)