azureformslogic

Azure Logic Apps: ExpressionEvaluationFailed failed


I am trying to create a small onboarding automator using Microsoft Forms and Logic Apps. I have only added 2 steps so far:

I receive the following error message when I try running it: enter image description here

Error message: ExpressionEvaluationFailed The execution of template action 'For_each' failed: the result of the evaluation of 'foreach' expression '@triggerBody()?['value']' is of type 'Null'. The result must be a valid array.**

Settings: enter image description here

What could be the issue?

Thanks in advance for the help!

Tried setting it up again, but did not work.

Without the ForEach I receive the following error message:

error message

Code:

 { "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" }

Solution

  • You should be able to get the response details without using the for each loop as well.

    I am using the below workflow-

    enter image description here

    Please make sure, you have enabled Split on and selected the given value from the dropdown as shown below.

    enter image description here

    enter image description here

    Code-

    {
        "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"
                    }
                }
            }
        }
    }
    

    enter image description here

    enter image description here