Power Platform自定义连接器可以在流中工作,但不能在画布应用中工作



我有一个自定义连接器,可以完美地用于我构建的任何类型的流。当我尝试在画布应用程序中使用相同的连接器时,似乎没有发生任何事情。也没有错误消息,监视器指示成功:

{
"status": 200,
"duration": 311.5,
"dataSource": "DS",
"responseSize": 0,
"controlName": "btnSendToDS",
"propertyName": "OnSelect",
"nodeId": 16,
"formulaData": {
"script": "",
"spanStart": null,
"spanEnd": null
},
"data": {
"context": {
"entityName": "btnSendToDS",
"propertyName": "OnSelect",
"nodeId": 16,
"id": 343,
"diagnosticContext": {
"dataOperation": {
"protocol": "rest",
"operation": "upsertTask",
"dataSource": "DS"
}
}
},
"request": {
"url": "https://europe-002.azure-apim.net/apim/dime-2escheduler-20import-5fa42ba8c1798e4bb5-5ffc65ed5301df6bbf/949038e657344d26be8687bfb0eddb41/task",
"method": "POST",
"headers": {
"x-ms-pa-client-telemetry-options": "paclient-telemetry {"operationName":"/providers/microsoft.powerapps/apis/shared_dime-2escheduler-20import-5fa42ba8c1798e4bb5-5ffc65ed5301df6bbf.upsertTask"}",
"ServiceNamespace": "DS",
"Content-Type": "application/json"
},
"body": {
"sourceApp": "POWERAPPS",
"sourceType": "POWERAPPS",
"jobNo": "POWERAPP_001",
"taskNo": "DRUNKER_SAILOR",
"shortDescription": "What shall we do?",
"description": "What shall we do?"
}
},
"response": {
"duration": 311.5,
"size": 0,
"status": 200,
"headers": {
"Content-Length": 0,
"Date": "Thu, 23 Jun 2022 09:12:07 GMT",
"x-ms-apihub-cached-response": false,
"x-ms-apihub-obo": true
},
"body": "",
"responseType": "pabinary"
},
"startTime": 12581.6,
"name": "https://europe-002.azure-apim.net/invoke",
"fetchStart": 12606.1,
"responseEnd": 12888.4,
"nextHopProtocol": ""
}
}

自定义连接器只是调用Azure API Management端点,但根据该服务中的分析/日志,它永远不会到达那里。

它确实与PowerApp有关,因为如果我通过Flow运行相同的端点,API就会被正确调用。对于按钮的OnSelect事件,我调用以下代码:

'DS'.Task(
{        
'ds-append': true,
sourceApp: "POWERAPPS",
sourceType: "POWERAPPS",
jobNo: "POWERAPP_001",
taskNo: tblTasks.Selected.Id,
shortDescription: tblTasks.Selected.Description,
description: tblTasks.Selected.Description
}
);

我在这里错过了什么吗?

事实证明,问题不一定与画布应用程序有关,而是与后端有关,这是一个Azure API管理实例。我调整了API的CORS设置以允许GET和OPTIONS方法,这就解决了问题。

为将来参考,请尝试以下解决方案:

<cors allow-credentials="false">
<allowed-origins>
<origin>*</origin>
</allowed-origins>
<allowed-methods>
<method>*</method>
</allowed-methods>
<allowed-headers>
<header>*</header>
</allowed-headers>
</cors>

如果有效,您显然可以在之后微调设置。

相关内容

最新更新