我正在尝试使用 Microsoft Forms 和 Logic Apps 创建一个小型入职自动化程序。 到目前为止我只添加了 2 个步骤:
当我尝试运行它时收到以下错误消息:
错误信息: 表达式评估失败 模板操作“For_each”的执行失败:“foreach”表达式“@triggerBody()?['value']”的计算结果的类型为“Null”。结果必须是有效的数组。**
设置:
可能是什么问题?
预先感谢您的帮助!
尝试再次设置,但没有成功。
如果没有 ForEach,我会收到以下错误消息:
代码:
{ "type": "ApiConnection", "inputs": { "host": { "connection": { "referenceName": "microsoftforms" } }, "method": "get", "path": "/formapi/api/forms('@{encodeURIComponent('9Ywju8lmBkaYUqnz4XgtY3wbRXZdAfZPsqOnuOYzwdVUMlpPTkFTTzVCU1k3QjNZNThNTklHRjJYTS4u')}')/responses", "queries": { "response_id": "@items('For_each')?['resourceData']?['responseId']" } }, "runAfter": {}, "operationOptions": "DisableAsyncPattern, DisableAutomaticDecompression" }
您应该能够在不使用 foreach 循环的情况下获取响应详细信息。
我正在使用以下工作流程-
请确保您已启用 Split on 并从下拉列表中选择给定值,如下所示。
代码-
{
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Get_response_details": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['microsoftforms']['connectionId']"
}
},
"method": "get",
"path": "/formapi/api/forms('@{encodeURIComponent('v4j5cvGGr*************FBGNVBISy4u')}')/responses",
"queries": {
"response_id": "@triggerBody()?['resourceData']?['responseId']"
}
},
"runAfter": {},
"type": "ApiConnection"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_new_response_is_submitted": {
"inputs": {
"body": {
"eventType": "responseAdded",
"notificationUrl": "@{listCallbackUrl()}",
"source": "ms-connector"
},
"host": {
"connection": {
"name": "@parameters('$connections')['microsoftforms']['connectionId']"
}
},
"path": "/formapi/api/forms/@{encodeURIComponent('v4j5cvGGr0GRqy1*************GNVBISy4u')}/webhooks"
},
"splitOn": "@triggerBody()?['value']",
"type": "ApiConnectionWebhook"
}
}
},
"parameters": {
"$connections": {
"value": {
"microsoftforms": {
"connectionId": "/subscriptions/b83c*********074c23f/resourceGroups/********/providers/Microsoft.Web/connections/microsoftforms",
"connectionName": "microsoftforms",
"id": "/subscriptions/b83************4c23f/providers/Microsoft.Web/locations/eastus/managedApis/microsoftforms"
}
}
}
}
}
triggerBody()?['value']
值为 null。