尝试在我的逻辑应用程序中获取Azure函数的输出时遇到一些问题。
当我查看azure函数的输出时,在正文中,"m_StringValue"
返回我想要的内容。当我在紧随其后的条件下检查azure函数主体是否返回了我想要的东西时,它返回false。
Azure Logic应用流程:
Azure Logic App输出:
应用代码如下
{
"$connections": {
"value": {
"azureblob_1": {
"connectionId": "x",
"connectionName": "azureblob-5",
"id": "x"
},
"office365": {
"connectionId": "x",
"connectionName": "office365-5",
"id": "x"
}
}
},
"definition": {
"$schema": "https://schema.management.azure.com/providers/Microsoft.Logic/schemas/2016-06-01/workflowdefinition.json#",
"actions": {
"Is_from_a_known_sender": {
"actions": {
"Should_be_forwarded_to_a": {
"actions": {},
"else": {
"actions": {
"Should_be_forwarded_to_b": {
"actions": {
"For_each": {
"actions": {
"Condition_2": {
"actions": {},
"expression": {
"and": [
{
"contains": [
"@body('Parse_JSON')?['properties']?['m_StringValue']",
"abc"
]
}
]
},
"runAfter": {
"Parse_JSON": [
"Succeeded"
]
},
"type": "If"
},
"Create_blob_for_each_attachment": {
"inputs": {
"body": "@base64ToBinary(items('For_each')?['ContentBytes'])",
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob_1']['connectionId']"
}
},
"method": "post",
"path": "/datasets/default/files",
"queries": {
"folderPath": "/attachments",
"name": "@items('For_each')?['Name']",
"queryParametersSingleEncoded": true
}
},
"runAfter": {},
"runtimeConfiguration": {
"contentTransfer": {
"transferMode": "Chunked"
}
},
"type": "ApiConnection"
},
"ExtractTextFromPDF": {
"inputs": {
"body": "@body('Get_blob_content')",
"function": {
"id": "x"
}
},
"runAfter": {
"Get_blob_content": [
"Succeeded"
]
},
"type": "Function"
},
"Get_blob_content": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['azureblob_1']['connectionId']"
}
},
"method": "get",
"path": "/datasets/default/files/@{encodeURIComponent(encodeURIComponent(body('Create_blob_for_each_attachment')?['Id']))}/content",
"queries": {
"inferContentType": true
}
},
"runAfter": {
"Create_blob_for_each_attachment": [
"Succeeded"
]
},
"type": "ApiConnection"
},
"Parse_JSON": {
"inputs": {
"content": "@body('ExtractTextFromPDF')",
"schema": {
"properties": {
"m_MaxCapacity": {
"type": "integer"
},
"m_StringValue": {
"type": "string"
}
},
"type": "object"
}
},
"runAfter": {
"ExtractTextFromPDF": [
"Succeeded"
]
},
"type": "ParseJson"
}
},
"foreach": "@triggerBody()?['Attachments']",
"runAfter": {},
"type": "Foreach"
}
},
"expression": {
"and": [
{
"contains": [
"@triggerBody()?['From']",
"xandreu"
]
}
]
},
"runAfter": {},
"type": "If"
}
}
},
"expression": {
"and": [
{
"contains": [
"@triggerBody()?['From']",
"test"
]
}
]
},
"runAfter": {},
"type": "If"
}
},
"expression": {
"and": [
{
"or": [
{
"contains": [
"@triggerBody()?['From']",
"xandreu"
]
}
]
},
{
"equals": [
"@triggerBody()?['HasAttachment']",
true
]
}
]
},
"runAfter": {},
"type": "If"
}
},
"contentVersion": "1.0.0.0",
"outputs": {},
"parameters": {
"$connections": {
"defaultValue": {},
"type": "Object"
}
},
"triggers": {
"When_a_new_email_arrives": {
"inputs": {
"host": {
"connection": {
"name": "@parameters('$connections')['office365']['connectionId']"
}
},
"method": "get",
"path": "/Mail/OnNewEmail",
"queries": {
"fetchOnlyWithAttachment": true,
"folderPath": "Inbox",
"importance": "Any",
"includeAttachments": true
}
},
"recurrence": {
"frequency": "Minute",
"interval": 3
},
"splitOn": "@triggerBody()?['value']",
"type": "ApiConnection"
}
}
}
}