Skip to content

combine initialize variables #1447

@Ibrahim-Ali81

Description

@Ibrahim-Ali81

Describe the Bug

with combine initialize variables, if one of the variables default value references another variable, we have rutime error as below
"Unable to process template language expressions in action 'Initialize_variables' inputs at line '0' and column '0': 'Template language expression cannot be evaluated: the template variable 'alert-resource-name' cannot be found.'."
issue is reproducible with below code for initialize variable
{
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "alert-resource-name",
"type": "string",
"value": "thhhhhhhhhhhhhhhhhhhhhhhh"
},
{
"name": "alert-logic-app-name",
"type": "string",
"value": "@{substring(variables('alert-resource-name'), 0, sub(length(variables('alert-resource-name')), 4)) }"
}
]
},
"runAfter": {}
}

so the workaround is to clear site data in browser developer tools under application tab as illustrated below and select No in the dialog related to this feature to combing initialize variables:

Image

Plan Type

Consumption

Steps to Reproduce the Bug or Issue

1-create logic app consumption with manual or recurrence trigger
2-add initialize variable with below code
{
"type": "InitializeVariable",
"inputs": {
"variables": [
{
"name": "alert-resource-name",
"type": "string",
"value": "thhhhhhhhhhhhhhhhhhhhhhhh"
},
{
"name": "alert-logic-app-name",
"type": "string",
"value": "@{substring(variables('alert-resource-name'), 0, sub(length(variables('alert-resource-name')), 4)) }"
}
]
},
"runAfter": {}
}
3-run logic app, you will have error in run history on initialize variable similar to the below one
InvalidTemplate
Unable to process template language expressions in action 'Initialize_variables' inputs at line '0' and column '0': 'Template language expression cannot be evaluated: the template variable 'alert-resource-name' cannot be found.'.

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": {
            "Initialize_variables": {
                "runAfter": {},
                "type": "InitializeVariable",
                "inputs": {
                    "variables": [
                        {
                            "name": "alert-resource-name",
                            "type": "string",
                            "value": "thhhhhhhhhhhhhhhhhhhhhhhh"
                        },
                        {
                            "name": "alert-logic-app-name",
                            "type": "string",
                            "value": "@{substring(variables('alert-resource-name'), 0, sub(length(variables('alert-resource-name')), 4)) }"
                        }
                    ]
                }
            }
        },
        "outputs": {},
        "parameters": {
            "hh": {
                "defaultValue": "test",
                "type": "String"
            },
            "$connections": {
                "type": "Object",
                "defaultValue": {}
            }
        }
    },
    "parameters": {
        "$connections": {
            "type": "Object",
            "value": {}
        }
    }
}

Screenshots or Videos

Image

Additional context

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions