logicapps
logicapps copied to clipboard
Accessing Array elements in DotLiquid template throws undefined error
Describe the Bug with repro steps
- Setup an action to trigger every time a file is uploaded to Blob storage.
{
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"referenceName": "azureblob-3"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('https://<accountname>.blob.core.windows.net/'))}/triggers/batch/onupdatedfile",
"queries": {
"folderId": "JTJmaGlyaW5nZmVlZHN0b3Jl",
"maxFileCount": 10,
"checkBothCreatedAndModifiedDateTime": false
}
},
"recurrence": {
"interval": 15,
"frequency": "Second"
},
"splitOn": "@triggerBody()",
"metadata": {
"JTJmaGlyaW5nZmVlZHN0b3Jl": "/<containername>"
}
}
- Setup a "Get blob content (V2)" action to download JSON file from Blob storage.
{
"type": "ApiConnection",
"inputs": {
"host": {
"connection": {
"referenceName": "azureblob-3"
}
},
"method": "get",
"path": "/v2/datasets/@{encodeURIComponent(encodeURIComponent('https://<accountname>.blob.core.windows.net/'))}/files/@{encodeURIComponent(encodeURIComponent(triggerBody()?['Id']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {}
}
- Setup a "Parse JSON" action to parse the downloaded json content. This is the content that will be passed to "Transform JSON to JSON" action.
{
"type": "ParseJson",
"inputs": {
"content": "@decodeBase64(body('Get_blob_content_(V2)')['$content'])",
"schema": {
"type": "object",
"properties": {
"examDate": {
"type": "string"
},
"examids": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "object",
"properties": {
"idtype": {
"type": "string"
},
"idvalue": {
"type": "string"
}
}
}
},
"required": [
"id"
]
}
}
}
}
},
"runAfter": {
"Get_blob_content_(V2)": [
"SUCCEEDED"
]
}
}
- Setup Liquid "Transform JSON to JSON" action.
{
"type": "Liquid",
"kind": "JsonToJson",
"inputs": {
"content": "@body('Parse_JSON')",
"map": {
"source": "LogicApp",
"name": "proposed-hiring-record-map-v1.liquid"
}
},
"runAfter": {
"Parse_JSON": [
"SUCCEEDED"
]
}
}
What type of Logic App Is this happening in?
Standard (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
No response
Screenshots or Videos
Sample JSON payload to test with
{
"examDate": "2023-12-31",
"examids":
[
{
"id": {
"idtype": "examId",
"idvalue": "123456"
}
},
{
"id": {
"idtype": "centerId",
"idvalue": "654321"
}
}
]
}
Sample liquid template
Accessing content.examids throws undefined, undefined error and workflow execution stops. Accessing any array element throws undefined exception
{
"examDate": "{{ content.examDate }}"
{{ content.examids.size }}
}
Browser
Chrome, Safari, IE
Additional context
No response
AB#25342581