2016-01-25 50 views
1

嘗試了一個簡單的邏輯應用程序,我可以從API檢索列表。通過列表功能重複使用,我可以爲列表中的每個項目發送一封電子郵件。我可以爲重複列表中的每個項目鏈接多個操作

但我真的希望能夠爲列表中的每個項目執行多個鏈接操作/步驟......這不可能嗎?我知道我可以有多個動作/步驟執行的東西在同一列表中的每個項目......但這些都沒有鏈接如下面的代碼:

"triggers": { 
    "recurrence": { 
     "recurrence": { 
      "frequency": "Day", 
      "interval": 1 
     }, 
     "type": "Recurrence" 
    } 
}, 
"actions": { 
    "http": { 
     "type": "Http", 
     "inputs": { 
      "method": "GET", 
      "uri": "https://example.com/pcme/3/7", 
      "headers": { 
       "Content-Type": "application/json", 
       "Authorization": "Basic my auth" 
      } 
     }, 
     "conditions": [] 
    }, 
    "office365connector": { 
     "type": "ApiApp", 
     "inputs": { 
      "apiVersion": "2015-01-14", 
      "host": { 
       "id": "/subscriptions/xxxx/resourcegroups/workflows/providers/Microsoft.AppService/apiapps/office365connector", 
       "gateway": "https://workflowsxxxxxx.azurewebsites.net" 
      }, 
      "operation": "SendMail", 
      "parameters": { 
       "message": { 
        "To": "[email protected]", 
        "Subject": "@repeatItem().activationCode" 
       } 
      }, 
      "authentication": { 
       "type": "Raw", 
       "scheme": "Zumo", 
       "parameter": "@parameters('/subscriptions/xxxxxx/resourcegroups/workflows/providers/Microsoft.AppService/apiapps/office365connector/token')" 
      } 
     }, 
     "repeat": "@body('http')", 
     "conditions": [ 
      { 
       "expression": "@equals(actions('http').status, 'Succeeded')" 
      } 
     ] 
    }, 
    "office365connector0": { 
     "type": "ApiApp", 
     "inputs": { 
      "apiVersion": "2015-01-14", 
      "host": { 
       "id": "/subscriptions/xxxx/resourcegroups/workflows/providers/Microsoft.AppService/apiapps/office365connector", 
       "gateway": "https://workflowsdxxxx.azurewebsites.net" 
      }, 
      "operation": "SendMail", 
      "parameters": { 
       "message": { 
        "To": "[email protected]", 
        "Subject": "@repeatItem().cardNumber" 
       } 
      }, 
      "authentication": { 
       "type": "Raw", 
       "scheme": "Zumo", 
       "parameter": "@parameters('/subscriptions/xxxxx/resourcegroups/workflows/providers/Microsoft.AppService/apiapps/office365connector/token')" 
      } 
     }, 
     "repeat": "@body('http')", 
     "conditions": [ 
      { 
       "expression": "@equals(actions('http').status, 'Succeeded')" 
      } 
     ] 
    } 

感謝您的任何幫助。

問候

回答

1

一個超過列表中的每個項目鏈接的行爲選擇是使用嵌套的邏輯應用。

您設置它的方式是讓您的孩子邏輯應用程序包含一系列要應用於每個單獨項目的操作。然後,父邏輯應用程序將使用工作流操作類型來調用每個重複項的子邏輯應用程序的運行。

你父母的工作流程將被定義爲

"actions": { 
    "http": { 
    "type": "Http", 
    "inputs": { 
     "method": "GET", 
     "uri": "https://example.com/pcme/3/7", 
     "headers": { 
     "Content-Type": "application/json", 
     "Authorization": "Basic my auth" 
     } 
    }, 
    "conditions": [] 
    }, 
    "processEachItem" : { 
    "type": "workflow", 
    "inputs": { 
     "uri": <child flow direct invoke uri>, 
     "apiVersion": "2015-02-01-preview", 
     "trigger": { 
      "name" : "runNow", 
      "outputs": { "item": "@repeatItem()" } 
     }, 
     "authentication": { 
     "type" : " Basic", 
     "username" : "myKey", 
     "password" : "xxxxxxxxxxxxxxx", 
     }, 
     "repeat": "@body('http')", 
    } 
    } 
} 

下面的博客文章介紹瞭如何使用嵌套的工作流程細節(如何獲取直接調用URI和配置身份驗證),並有一個很好的例子: https://blogs.msdn.microsoft.com/carlosag/2015/05/31/using-nested-azure-logic-apps-or-invoking-flows-from-another-logic-app/

相關問題