Azure / LogicAppsUX

https://learn.microsoft.com/azure/logic-apps
MIT License
75 stars 81 forks source link

Selecting dynamic content does not create correct expressions. #4963

Closed jesseck3013 closed 3 weeks ago

jesseck3013 commented 3 months ago

Describe the Bug with repro steps

  1. The output body of the action "Run query and visualize results" is a JSON in the following structure.
{
  "attachmentName": "azure_monitor_logs_flow_table_20240611052101.html",
  "attachmentContent": "content",
  "body": "content"
}
  1. There is only one Body in the dynamic content.

    image

  2. After selecting this Body, the designer creates an expression like this which is the entire output body.

body('Run_query_and_visualize_results')
  1. To select the inner body, the expression should be
body('Run_query_and_visualize_results')?['body']
  1. When opening the Insert Expression, there are two Body in the Dynamic content. Both of them generates the same expression. Still no way to select the inner body.
body('Run_query_and_visualize_results')

image

What type of Logic App Is this happening in?

Consumption (Portal)

Are you using new designer or old designer

New Designer

Did you refer to the TSG before filing this issue? https://aka.ms/lauxtsg

Yes

Workflow JSON

{
  "definition": {
    "$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
    "contentVersion": "1.0.0.0",
    "triggers": {
      "When_a_HTTP_request_is_received": {
        "type": "Request",
        "kind": "Http"
      }
    },
    "actions": {
      "Query_returns_data?": {
        "type": "If",
        "expression": {
          "and": [
            {
              "not": {
                "equals": [
                  "@body('Run_query_and_visualize_results')?['attachmentContent']",
                  "PGJvZHk+VGhlIHF1ZXJ5IHlpZWxkZWQgbm8gZGF0YVRhYmxlLjwvYm9keT4="
                ]
              }
            }
          ]
        },
        "actions": {
          "Send_an_email_(V2)": {
            "type": "ApiConnection",
            "inputs": {
              "host": {
                "connection": {
                  "name": "@parameters('$connections')['office365']['connectionId']"
                }
              },
              "method": "post",
              "body": {
                "To": "v-zs@microsoft.com",
                "Subject": "Testing HTML Table",
                "Body": "<p><span>\n</span>@{body('Run_query_and_visualize_results')?['body']}</p><p>@{base64ToString(body('Run_query_and_visualize_results')?['attachmentContent'])}</p>",
                "Attachments": [
                  {
                    "ContentBytes": "@{body('Run_query_and_visualize_results')?['attachmentContent']}",
                    "Name": "@body('Run_query_and_visualize_results')?['attachmentName']"
                  }
                ],
                "Importance": "Normal"
              },
              "path": "/v2/Mail"
            }
          }
        },
        "else": {
          "actions": {
            "Response": {
              "type": "Response",
              "kind": "Http",
              "inputs": {
                "statusCode": 200
              }
            }
          }
        },
        "runAfter": {
          "Run_query_and_visualize_results": [
            "Succeeded"
          ]
        }
      },
      "Run_query_and_visualize_results": {
        "type": "ApiConnection",
        "inputs": {
          "host": {
            "connection": {
              "name": "@parameters('$connections')['azuremonitorlogs-1']['connectionId']"
            }
          },
          "method": "post",
          "body": "print 1 + 1;",
          "path": "/visualizeQuery",
          "queries": {
            "subscriptions": "e2f5e6d4-569f-4921-8c57-5c01763bc934",
            "resourcegroups": "jc-lab",
            "resourcetype": "Log Analytics Workspace",
            "resourcename": "jc-sentinel",
            "timerange": "Last 7 days",
            "visType": "Html Table"
          }
        },
        "runAfter": {}
      }
    },
    "outputs": {},
    "parameters": {
      "$connections": {
        "type": "Object",
        "defaultValue": {}
      }
    }
  },
  "parameters": {
    "$connections": {
      "value": {
        "office365": {
          "id": "/subscriptions/e2f5e6d4-569f-4921-8c57-5c01763bc934/providers/Microsoft.Web/locations/eastus/managedApis/office365",
          "connectionId": "/subscriptions/e2f5e6d4-569f-4921-8c57-5c01763bc934/resourceGroups/jc-lab/providers/Microsoft.Web/connections/office365-1",
          "connectionName": "office365-1"
        },
        "azuremonitorlogs-1": {
          "id": "/subscriptions/e2f5e6d4-569f-4921-8c57-5c01763bc934/providers/Microsoft.Web/locations/eastus/managedApis/azuremonitorlogs",
          "connectionId": "/subscriptions/e2f5e6d4-569f-4921-8c57-5c01763bc934/resourceGroups/jc-lab/providers/Microsoft.Web/connections/azuremonitorlogs-4",
          "connectionName": "azuremonitorlogs-4",
          "connectionProperties": {
            "authentication": {
              "type": "ManagedServiceIdentity"
            }
          }
        }
      }
    }
  }
}

Screenshots or Videos

No response

Browser

Edge

Additional context

No response

Eric-B-Wu commented 3 months ago

This might be linked to https://github.com/Azure/LogicAppsUX/issues/4854, which I have a fix for. I'll verify this and if so, we can expect this to complete to all regions 6/22

Eric-B-Wu commented 3 weeks ago

This is fixed now, if you are still running into it, we can reopen for investigation