0

I have the following "Send http request to SharePoint", to update a lookup field Id for a list item:- enter image description here

the above will work fine, but if i want to clear the lookup ID, by send empty string, i will get this error:-

Cannot convert a primitive value to the expected type 'Edm.Int32'. See the inner exception for more details. clientRequestId: ed6b85fb-4be0-4d19-bf6f-fc01a7bd84fd serviceRequestId: 584d21a0-101f-c000-e1f8-7cba6e8c3d6f

enter image description here

so how i can fix this issue?

EDIT

I added a condition to check if the var is empty >> and if so to set it as null:- enter image description here

but i will get the same error:- enter image description here

1 Answer 1

0

Set the value to null rather than an empty string.

In the screen capture below, the expression used to set the CategoryId in the Compose REST request body action is if(equals(variables('CategoryId'),''),null,variables('CategoryId'))

Screen capture of flow

6
  • thanks for the reply.. but the value will not be always be null,, this depend if the user inside the form enter the Id or not.. now if the user enter the id everything will work fine, but if the user clear the value,, then the flow will fail.. thanks
    – John John
    Feb 16, 2022 at 13:57
  • 1
    You can use an If condition or expression to check for an empty string and, if you get one, you can convert it to null. Feb 16, 2022 at 13:59
  • just tried this .. but i got the same error!! can you check my edit please?
    – John John
    Feb 16, 2022 at 14:10
  • @johnGu I just updated my answer to address your edited question Feb 16, 2022 at 14:37
  • the exporession need to be as follow if(equals(variables('currentItemStoreID'),Blank()),null,concat('"',variables('currentItemStoreID'),'"')) but i got an error to enter a valid json..
    – John John
    Feb 16, 2022 at 15:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.