Search code examples
sharepointpower-automate

Condition to trigger flow only once for each item created/modified


I have a flow that does the following: When a item Sharepoint item is created or modified > add a row to a table > send an email

However, I want it to just do it the first time the item is created or modified, because now it’s just creating a new row for the same item every time I modify the item. If that item is modified again, I want it to do nothing.

Is it possible to add a condition that triggers the flow only the first time the item is created/modified? Or alternatively, for it to check if that item’s info already exists in the spreadsheet, and if it does then it will not create a row or send an email?

Simply changing to 'When an item is created' is not an option as my flow has a specific trigger condition (triggered when a specific column is changed).

EDIT: image


Solution

  • This is a question about logic. The best way to achieve what you're wanting is to first determine if the row exists. To do that, use the Get a row operation from the Excel Online connector.

    Get a row

    If the row doesn't exist, it will tell you.

    Row doesn't exist

    From there, you need to configure the run after settings to make sure it will continue if the operation errors.

    Run After 1

    Run After 2

    So the end result is ...

    1. If the row IS found, the flow will simply stop and not continue on.
    2. If the row IS NOT found, it will keep going and then execute your operation to add the row.

    Result