Reputation: 11
I have a simple Flow to create an item when a new email arrives:
When a new email arrives > Parse JSON > Create item
The flow does work however, none of the Yes/No fields are not updating to Yes when the incoming value is true; the default value is No so false values are working as expected.
When a new email arrives
{ ... "Driver": true, ... }
Parse JSON
{
...
"Driver": true,
...
}
Create item
INPUTS
...
Driver
true
...
OUTPUTS
...
Driver
true
...
List Item in SharePoint
Driver (Yes/No) is un-checked/false
I have read the solution to Flow fails on Yes/No column (Big Flow) but to no avail.
https://powerusers.microsoft.com/t5/Using-Flows/Flow-fails-on-Yes-No-column-Big-Flow/m-p/35116#M1086
To confirm, I have unsuccessfully tried to add the following dynamic content options:
// 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')
Now, I am just guessing so what am I missing?!
To summarise, my question is how do I successfully update Yes/No fields when creating an item from a MS Flow?
Upvotes: 1
Views: 3202
Reputation: 11
I stumbled onto a work-around, and accepted solution, where using the Send an HTTP request to SharePoint action to update the Description (Display Text) & URL fields of a Hyperlink field.
I found this post most helpful: Updating a Hyperlink field (both url and description) using Flow?
I used the same approach to update all Yes/No fields to Yes when the incoming value is true. Here are the key settings others may find useful.
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)))},
...
}
Upvotes: 0