Logic app with multiple triggers

This is a knowledgebase item about Azure Logic Apps. Hope it helps you out someday when you want to start a logic app with multiple triggers

Issue

By default, it is only possible to trigger a logic app with a single action. Like “When an item is created or modified”. In my case, I needed “When an item is created, modified, or deleted. This action does not exist in the trigger actions. Also, it was not possible via the GUI to set multiple triggers.

Solution

Via the Logic app code view it is possible to set multiple triggers. So, I have used the below code to set a second trigger for my Logic App.

Note.

If you are using multiple triggers, it is not possible to use the Logic app designer anymore. If you don’t have enough experience with code, start with the creation of the Azure logic app and when your flow is created set the second trigger via the code view, save and test.

"triggers": {
            "When_an_item_is_created_or_modified": {
                "evaluatedRecurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['sharepointonline']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/datasets/@{encodeURIComponent(encodeURIComponent(''))}/tables/@{encodeURIComponent(encodeURIComponent(''))}/onupdateditems"
                },
                "recurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "splitOn": "@triggerBody()?['value']",
                "type": "ApiConnection"
            },
            "When_an_item_is_deleted": {
                "evaluatedRecurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "inputs": {
                    "host": {
                        "connection": {
                            "name": "@parameters('$connections')['sharepointonline']['connectionId']"
                        }
                    },
                    "method": "get",
                    "path": "/datasets/@{encodeURIComponent(encodeURIComponent(''))}/tables/@{encodeURIComponent(encodeURIComponent(''))}/ondeleteditems"
                },
                "recurrence": {
                    "frequency": "Minute",
                    "interval": 3
                },
                "splitOn": "@triggerBody()?['value']",
                "type": "ApiConnection"
            }
        }

Results

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.