Azure 逻辑应用:ExpressionEvaluationFailed 失败

问题描述 投票:0回答:1

我正在尝试使用 Microsoft Forms 和 Logic Apps 创建一个小型入职自动化程序。 到目前为止我只添加了 2 个步骤:

当我尝试运行它时收到以下错误消息: enter image description here

错误信息: 表达式评估失败 模板操作“For_each”的执行失败:“foreach”表达式“@triggerBody()?['value']”的计算结果的类型为“Null”。结果必须是有效的数组。**

设置: enter image description here

可能是什么问题?

预先感谢您的帮助!

尝试再次设置,但没有成功。

如果没有 ForEach,我会收到以下错误消息:

error message

代码:

 { "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" }
azure forms logic
1个回答
0
投票

您应该能够在不使用 foreach 循环的情况下获取响应详细信息。

我正在使用以下工作流程-

enter image description here

请确保您已启用 Split on 并从下拉列表中选择给定值,如下所示。

enter image description here

enter image description here

代码-

{
    "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"
                }
            }
        }
    }
}
  • 每次以 Microsoft 表单提交响应时,都会触发此工作流程。如果您将看到 提交新响应时触发器的输出,则其中没有 value 参数。因此,您得到的
    triggerBody()?['value']
    值为 null。

enter image description here

  • 获取响应详细信息 操作中,它会根据 responseId 的值向您提供结果。

enter image description here

© www.soinside.com 2019 - 2024. All rights reserved.