0

When files added or Modified sftp-ssh Connector in logic app has only one trigger. In MS Documentation, it was mentioned we can have 10 triggers.can someone please let me know How to add multiple triggers to logic app SFT_SSH connector.

I have tried to add more triggers in triggers section in code view but it didnt work

My approach --> added another trigger with _2 in the name.

{
 "definition":{
  "$schema":"https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
  "actions":{
     
  },
  "contentVersion":"1.0.0.0",
  "outputs":{
     
  },
  "triggers":{
     "When_files_are_added_or_modified_(properties_only)":{
        "inputs":{
           "host":{
              "connection":{
                 "referenceName":"sftpwithssh_1"
              }
           },
           "method":"get",
           "path":"/datasets/default/triggers/batch/onupdatedfile",
           "queries":{
              "checkBothCreatedAndModifiedDateTime":false,
              "folderId":"L1NGVFB0ZXN0",
              "maxFileCount":10
           }
        },
        "metadata":{
           "L1NGVFB0ZXN0":"/SFTPtest"
        },
        "recurrence":{
           "frequency":"Second",
           "interval":10
        },
        "splitOn":"@triggerBody()",
        "type":"ApiConnection"
     },
     "When_files_are_added_or_modified_(properties_only)_2":{
        "inputs":{
           "host":{
              "connection":{
                 "referenceName":"sftpwithssh_1"
              }
           },
           "method":"get",
           "path":"/datasets/default/triggers/batch/onupdatedfile",
           "queries":{
              "checkBothCreatedAndModifiedDateTime":false,
              "folderId":"L1NGVFB0ZXN9",
              "maxFileCount":10
           }
        },
        "metadata":{
           "L1NGVFB0ZXN9":"/SFTPtest/Subfolder"
        },
        "recurrence":{
           "frequency":"Second",
           "interval":10
        },
        "splitOn":"@triggerBody()",
        "type":"ApiConnection"
     }
  }
 },
 "kind":"Stateful"
}
Vishnu
  • 1
  • 1
  • 1
    I think I’ve previously done it through the code view. Not the most ideal approach but all that’s available. I recall it not always working though but did manage to get it working at least once. – Skin Dec 20 '22 at 07:46

1 Answers1

0

You can add multiple triggers in logic app. As mentioned by @Skin, you can add multiple triggers in code view only. If logic app contains multiple triggers, it will not open in designer view. I have added two sftp triggers in my logic app. Below is code of my logic app with two triggers,

{

"definition": {

"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",

"actions": {},

"contentVersion": "1.0.0.0",

"outputs": {},

"parameters": {

"$connections": {

"defaultValue": {},

"type": "Object"

}

},

"triggers": {

"When_files_are_added_or_modified_(properties_only)": {

"inputs": {

"host": {

"connection": {

"name": "@parameters('$connections')['sftpwithssh']['connectionId']"

}

},

"method": "get",

"path": "/datasets/default/triggers/batch/onupdatedfile",

"queries": {

"checkBothCreatedAndModifiedDateTime": false,

"folderId": "6e202211-2856-4d17-9ded-5beb8b8626b0",

"maxFileCount": 10

}

},

"metadata": {

"6e202211-2856-4d17-9ded-5beb8b8626b0": "/"

},

"recurrence": {

"frequency": "Minute",

"interval": 3

},

"splitOn": "@triggerBody()",

"type": "ApiConnection"

},

"When_files_are_added_or_modified_(properties_only)_2": {

"inputs": {

"host": {

"connection": {

"name": "@parameters('$connections')['sftpwithssh_1']['connectionId']"

}

},

"method": "get",

"path": "/datasets/default/triggers/batch/onupdatedfile",

"queries": {

"checkBothCreatedAndModifiedDateTime": false,

"folderId": "6e202211-2856-4d17-9ded-5beb8b8626b0",

"maxFileCount": 10

}

},

"metadata": {

"6e202211-2856-4d17-9ded-5beb8b8626b0": "/abc"

},

"recurrence": {

"frequency": "Minute",

"interval": 3

},

"splitOn": "@triggerBody()",

"type": "ApiConnection"

}

}

},

"parameters": {

"$connections": {

"value": {

"sftpwithssh": {

"connectionId": "/subscriptions/xxx/resourceGroups/XXX/providers/Microsoft.Web/connections/sftpwithssh-1",

"connectionName": "sftpwithssh-1",

"id": "/subscriptions/xxx/providers/Microsoft.Web/locations/centralus/managedApis/sftpwithssh"

},

"sftpwithssh_1": {

"connectionId": "/subscriptions/xxxx/resourceGroups/so1/providers/Microsoft.Web/connections/sftpwithssh",

"connectionName": "sftpwithssh",

"id": "/subscriptions/xxxx/providers/Microsoft.Web/locations/centralus/managedApis/sftpwithssh"

}

}

}

}

}

I am not facing any issue with the above code. Below are few references for multiple triggers in a logic app, link1 link2 link3

vijaya
  • 1,525
  • 1
  • 2
  • 6
  • I have followed the same thing in my query but flow is not getting triggered if the file is dropped in subfolder – Vishnu Dec 20 '22 at 23:55