Working on one of my project I got a requirement regarding sending emails whenever a record moved from one status to another status. After going through multiple things we decided to use logic apps and send grid APIs to send emails. We have used a very straight forward approach to get it. Simply created a a new trigger on this table to capture change on status column and then through logic app started processing it on every 5 minutes. Below I will talk about, how to setup a logic app.
Step 1: Search for logic app in https://portal.azure.com search bar. Create a logic app:
Step 2: Provide details as requested and click on create.
Once created successfully you will find below details:
Step 3: Select recurrence as it’s a time based logic app to
check for status and sending emails.
Step4: Set recurrence interval, in this case keep it 5 mins.
Step 5: Create a connection with SQL server and select your
db. Also need to provide db admin details.
Step 6: Select server
name, db name and procedure.
Step 7: Select another procedure, which process our send email table and return rows we need to send emails.
Step 8: Search send grid and select an action as Send Email.
Step 9: As soon as you would select to ResultsTo from
dynamic contents in Send email action to field. A for each loop will be auto
inserted as shown in step 8.
Step 10: Press save and click on run.
Step 11: Go to overview section and check its executing
successfully as expected.