Add condition for 2 different columns

Copper Contributor

Hi everyone

 

I'm newby on PowerApps, so I'm playing with the Flows. I have a SharePoint list that has 4 date columns:

  • Creation Date (manual entry)
  • Expiration Date (calculated in base of Creation Date + 730 days)
  • New Creation Date (manual entry)
  • New Expiration Date (calculated in base of New Creation Date + 330 days)

The requirement is to send an email notification when expiration date is coming on 30 days prior expire.

So I have set a flow as below:

  • Set a Get Items to get all the items from the sharepoint list.

2022-02-09_13-41-24.png

  • Then set a condition because the new creation date and new expiration date are not required fields, so it can be filled whenever is required, based in another field if is null or not.

2022-02-09_13-42-04.png

  • After validating if the previous field is null, then it will depend the Yes/No path which is basically the same, using another Get Items but changing the filter query with the following formula:
  • If YES: 

 

 

CreationDate le '{formatDateTime(addDays(utcNow(),-700),'yyyy-MM-dd')}'​

 

 

  • If NO: 

 

 

NewCreationDate le '{formatDateTime(addDays(utcNow(),-330),'yyyy-MM-dd')}'​

 

 

2022-02-09_13-43-43.png

 

  • Then it triggers the email.

 

The flow is working and sending the email properly, however, the issue is that it is triggering the email multiple times based on the number of records it finds, for example, in my testing I have 5 records at the list, 2 have expiration date next year, so those are fine, another 2 records that should go through NO path and 1 through YES path, so I should receive only 3 emails, but instead of, I'm receiving 9 emails as it is looping 3 times the email trigger.

 

Any help on this will be appreciated.

0 Replies