SharePoint Yes/No 字段未从 Power Automate 更新
SharePoint Yes/No fields not updating from Power Automate
我有一个简单的流程来在收到新电子邮件时创建项目:
When a new email arrives > Parse JSON > Create item
流程确实有效,但是,当输入值为 true 时,Yes/No 字段中的 none 不会更新为 Yes;默认值为否,因此 false 值按预期工作。
收到新邮件时
{ ... "Driver": true, ... }
解析JSON
{
...
"Driver": true,
...
}
创建项目
输入
...
Driver
true
...
输出
...
Driver
true
...
在 SharePoint 中列出项目
Driver (Yes/No) is un-checked/false
我已经阅读了 Flow fails on Yes/No column (Big Flow) 的解决方案,但无济于事。
https://powerusers.microsoft.com/t5/Using-Flows/Flow-fails-on-Yes-No-column-Big-Flow/m-p/35116#M1086
确认一下,我未成功尝试添加以下动态内容选项:
// In-correctly assumed the below line should work since a Yes/No field is a simple Boolean field;
// returns true but doesn't check the Driver checkbox in Item
body('Parse_JSON')?['json']?['Driver']
// Solution to Flow fails on Yes/No column (Big Flow);
// https://powerusers.microsoft.com/t5/Using-Flows/Flow-fails-on-Yes-No-column-Big-Flow/m-p/35116#M1086
// returns true but doesn't check the Driver checkbox in Item
equals(body('Parse_JSON')?['json']?['Driver'], true)
// All returns true but doesn't check the Driver checkbox in Item
if(body('Parse_JSON')?['json']?['Driver'], true, false)
if(body('Parse_JSON')?['json']?['Driver'], 'True', 'False')
if(equals(body('Parse_JSON')?['json']?['Driver'], true), true, false)
if(equals(body('Parse_JSON')?['json']?['Driver'], true), 'True', 'False')
// Throws error; and Flow fails as expected
if(body('Parse_JSON')?['json']?['Driver'], 'Yes', 'No')
if(equals(body('Parse_JSON')?['json']?['Driver'], true), 'Yes', 'No')
现在,我只是在猜测,所以我错过了什么?!
总而言之,我的问题是如何在从 MS Flow 创建项目时成功更新 Yes/No 字段?
我偶然发现了一个解决方案,并接受了解决方案,其中使用向 SharePoint 发送 HTTP 请求操作来更新超链接字段的描述(显示文本)和 URL 字段。
我发现这个 post 最有帮助:Updating a Hyperlink field (both url and description) using Flow?
当输入值为 true 时,我使用相同的方法将所有 Yes/No 字段更新为 Yes。以下是其他人可能会觉得有用的关键设置。
Site Address: https://MyFakeSite.sharepoint.com/
Method: POST
Url: _api/web/lists/GetByTitle('MyFakeList')/Items(@{body('Create_item')?['ID']})
Headers: {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-HTTP-Method": "MERGE",
"IF-MATCH": "*"
}
Body: {
'__metadata': {
'type': 'SP.Data.MyFakeListItem'
},
'Driver': @{toLower(string(equals(body('Parse_JSON')?['json']?['Driver'], true)))},
...
}
我有一个简单的流程来在收到新电子邮件时创建项目:
When a new email arrives > Parse JSON > Create item
流程确实有效,但是,当输入值为 true 时,Yes/No 字段中的 none 不会更新为 Yes;默认值为否,因此 false 值按预期工作。
收到新邮件时
{ ... "Driver": true, ... }
解析JSON
{
...
"Driver": true,
...
}
创建项目
输入
...
Driver
true
...
输出
...
Driver
true
...
在 SharePoint 中列出项目
Driver (Yes/No) is un-checked/false
我已经阅读了 Flow fails on Yes/No column (Big Flow) 的解决方案,但无济于事。
https://powerusers.microsoft.com/t5/Using-Flows/Flow-fails-on-Yes-No-column-Big-Flow/m-p/35116#M1086
确认一下,我未成功尝试添加以下动态内容选项:
// In-correctly assumed the below line should work since a Yes/No field is a simple Boolean field;
// returns true but doesn't check the Driver checkbox in Item
body('Parse_JSON')?['json']?['Driver']
// Solution to Flow fails on Yes/No column (Big Flow);
// https://powerusers.microsoft.com/t5/Using-Flows/Flow-fails-on-Yes-No-column-Big-Flow/m-p/35116#M1086
// returns true but doesn't check the Driver checkbox in Item
equals(body('Parse_JSON')?['json']?['Driver'], true)
// All returns true but doesn't check the Driver checkbox in Item
if(body('Parse_JSON')?['json']?['Driver'], true, false)
if(body('Parse_JSON')?['json']?['Driver'], 'True', 'False')
if(equals(body('Parse_JSON')?['json']?['Driver'], true), true, false)
if(equals(body('Parse_JSON')?['json']?['Driver'], true), 'True', 'False')
// Throws error; and Flow fails as expected
if(body('Parse_JSON')?['json']?['Driver'], 'Yes', 'No')
if(equals(body('Parse_JSON')?['json']?['Driver'], true), 'Yes', 'No')
现在,我只是在猜测,所以我错过了什么?!
总而言之,我的问题是如何在从 MS Flow 创建项目时成功更新 Yes/No 字段?
我偶然发现了一个解决方案,并接受了解决方案,其中使用向 SharePoint 发送 HTTP 请求操作来更新超链接字段的描述(显示文本)和 URL 字段。
我发现这个 post 最有帮助:Updating a Hyperlink field (both url and description) using Flow?
当输入值为 true 时,我使用相同的方法将所有 Yes/No 字段更新为 Yes。以下是其他人可能会觉得有用的关键设置。
Site Address: https://MyFakeSite.sharepoint.com/
Method: POST
Url: _api/web/lists/GetByTitle('MyFakeList')/Items(@{body('Create_item')?['ID']})
Headers: {
"Accept": "application/json;odata=verbose",
"Content-Type": "application/json;odata=verbose",
"X-HTTP-Method": "MERGE",
"IF-MATCH": "*"
}
Body: {
'__metadata': {
'type': 'SP.Data.MyFakeListItem'
},
'Driver': @{toLower(string(equals(body('Parse_JSON')?['json']?['Driver'], true)))},
...
}