Blog Post

Azure Integration Services Blog
1 MIN READ

Duplicate detection in Logic App Trigger

Mohammed_Barqawi's avatar
Nov 17, 2025

Duplicate Detection in Logic App Trigger

Overview

In certain scenarios, a Logic App may process the same item multiple times due to various reasons. Common examples include:

Solution Approach

To address this issue, I implemented a solution using the Logic Apps REST API:
Workflow Runs - List - REST API (Azure Logic Apps) | Microsoft Learn

The idea is simple:
Each time the Logic App is triggered, it searches all available runs within a specified time window for the same clientTrackingId.

Implementation Details

Step 1: Extract clientTrackingId

 

For the SharePoint trigger example, I used the file name as the clientTrackingId with the following expression:

 

@string(trigger()['outputs']['body']['value'][0]['{FilenameWithExtension}'])

 

Step 2: Pass Payload to Duplicate Detector Flow

 

 

The payload includes:

  • clientTrackingId (chosen identifier)
  • Resource URI for the SharePoint flow
  • Time window to check against

Duplicate Detector Flow Logic

The flow retrieves the run history and checks if the number of runs is greater than 1. If so, the same file was processed before:

the http response will have the below status 

if(greater(length(body('HTTP-Get_History')['value']), 1), '400', '200')

 

Important Notes

  • The Duplicate Detector Flow must have Logic Apps Standard Reader (Preview) permission for the resource group.
  • The solution is built on Logic App Standard, but it can be adapted for Logic App Consumption or Power Automate.

GitHub Link

logicappfiles/Logic Apps Duplicate Detector at main · mbarqawi/logicappfiles

 

Published Nov 17, 2025
Version 1.0

2 Comments

  • ChrisStylianou's avatar
    ChrisStylianou
    Copper Contributor

    Many thanks for your approach - would it suffer a race-condition if the triggers happen within milliseconds of each other (as we find dynamics does with an edit sometimes) - i'm concerned the two runs would see each other and neither would process

    • Mohammed_Barqawi's avatar
      Mohammed_Barqawi
      Icon for Microsoft rankMicrosoft

      Honestly, testing this scenario is tricky—did it happen to you? Persisting the run in the storage table is an Atomic operation

      I believe, so the chances are low, but there’s no such thing as a 100% guarantee.