I am building a flow to copy all items in one SharePoint list to another SharePoint list in the same site. The target list varies, so I am creating the list name as a variable. I can't use the Create Item action, as it won't accept a variable as a list name. So I am using Send an HTTP request instead, embedded in a For Each loop.

The problem is, there are several fields that are blank in the source list, so I have to build an if statement inside the JSON. Basically, if the boolean field is empty, I want to pass false, otherwise pass the value from the source item. But I keep getting errors no matter how I craft the syntax.

The error is "Cannot convert a primitive value to the expected type 'EDM.Boolean'".

Here is the line of code in JSON:

"LWOP": "@{if(empty(items('Apply_to_each')?['LWOP']),false,items('Apply_to_each')?['LWOP'])}",

That SHOULD return false if LWOP is empty, and the value if it is not. I am also having trouble trying to pass a null value for a number field or a date field. I tried inserting null where the false appears, but it seems the JSON requires "LWOP": null vice "LWOP": "null" (for a number or date field).

Short of creating an IF condition for all six fields that might be empty, what is the proper JSON syntax to check for an empty value and return something in it's place?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.