I can try to help you create an Azure Logic App using the steps you’ve outlined. Try this approach:
Create a new Logic App:
- Go to the Azure portal, navigate to “Logic Apps,” and create a new Logic App.
Add an HTTP trigger:
- Choose the “When an HTTP request is received” trigger. This will allow you to simulate requests using Postman.
Step 1: Send an email action:
- Add a new step and select the “Office 365 Outlook—Send an email” action. Configure the email details (To, Subject, Body, etc.).
Step 2: Condition to check if the email body is empty:
- Add a condition action.
- Set the condition to check if the
email_body
is empty:@empty(triggerBody()?['email_body'])
.
- Set the condition to check if the
Step 3: Condition to check if the given date is greater than the current date:
- Add another condition action within the “If true” branch of the previous condition.
- Use the expression:
@greater(concat(substring(triggerBody()?['email_date'], 6, 4), '-', substring(triggerBody()?['email_date'], 3, 2), '-', substring(triggerBody()?['email_date'], 0, 2)), utcNow())
- Use the expression:
Step 4: Add a switch case within step 2:
Within the “If true” branch of the second condition, add a “Switch” action.
- Set the switch to evaluate the
email_status
(or a similar field).
Add cases to the switch:
- Case 1: Email Approved:
- Add a case with the value “approved”.
- Within this case, add an action to send an email (similar to step 1).
- Case 2: Email Rejected:
- Add a case with the value “rejected”.
- No action is needed here if you don’t want to send an email.
Test your Logic App:
- Save and run your Logic App.
- Use Postman to send HTTP requests to your Logic App’s endpoint to test the workflow.
If this answers your question, please click Accept Answer and Yes if this answer was helpful. Doing so would help other community members with similar issues identify the solution. I highly appreciate your contribution to the community.