Search code examples
power-automatepowerapps

How can a flow run multiple times without creating duplicates of user entries via HTTP?


I get Entra ID users via an HTTP GET method, which are then created via an HTTP Post method in Microsoft Saleshub.

Structure:

  1. HTTP GET Entra ID User

  2. JSON Analyzer

    {
    "type": "object",
    "properties": {
        "value": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "surname": {
                        "type": "string"
                    }
                }
            }
        }
    }
    

    }

  3. HTTP GET Saleshub User

  4. JSON Analyzer

    {
    "type": "object",
    "properties": {
        "value": {
            "type": "array",
            "items": {
                "type": "object",
                "properties": {
                    "lastname": {
                        "type": "string"
                    }
                }
            }
        }
    }
    

    }

  5. For each (value)

  6. HTTP POST (Saleshub surname)

If I now execute the flow again, all the contacts created are recreated.

How can I configure the flow so that it only creates contacts that have not yet been created?


Solution

  • I got it:

    • I GET all Entra ID User with a HTTP Request
    • Analyze the json
    • Call Saleshub
    • create new string "true" = true
    • create new string "array" = ""
    • For each(body from entra id): array = false
    • Check if lastname from Saleshub equals surname from entra id
    • If array = true: create new lead, else do nothing