0
votes

I have a Logic App which will trigger whenever a record is created in Salesforce CRM, after that I have SQL server insert action where it will inserts the salesforce CRM record into azure SQL database.

Here my question is, if my Azure SQL database is down or failed to connect. What will happen to the record which is failed? Is logic app will retry to insert the failed record again or not?

2

2 Answers

2
votes

By default not.

But you have the Do-Until Loops, where you define a condition for repeating an action. In your condition you can simply evaluate the result of the SQL Insert.

I use, for example the following expression to make a reliable call to a REST API:

        "GetBerlinDataReliable": {
            "actions": {
                "GetBerlinData": {
                    "inputs": {
                        "method": "GET",
                        "uri": "http://my.rest.api/path?query"
                    },
                    "runAfter": {},
                    "type": "Http"
                }
            },
            "expression": "@and(equals(outputs('GetBerlinData').statusCode, 200),greaterOrEquals(body('GetBerlinData').query?.count, 1))",
            "limit": {
                "count": 100,
                "timeout": "PT30M"
            },
            "runAfter": {},
            "type": "Until"
        },
2
votes

It depends on whether the HTTP code from such API is retry-able or not. If it is, we will by default retry 4 times with 30 seconds in between (you can change that in Settings of a given action as well). If it is not, then no retry will happen.

There are multiple ways to handle errors, depending on what and how you expect the error to occur: do-until like mentioned above is one way, or you an consider a try(insert)-catch(save to blob) and have another Logic Apps to check blob and retry insert.