Can no longer post empty string to blank a sharepoint choice field

Copper Contributor
I am making a batch graph api call from a flow to import some data into a sharepoint list.  This has been working for months and suddenly broke a couple of days ago, nothing has been changed in the list or the flow. The pilot field is a Choice type.

      
"method""POST",
      "url""/sites/xyz.sharepoint.com:/sites/xyzsite:/lists/xyzlist/items",
...
 "pilot""",
 
Previously this just blanked the field, now returns an error... 

  
"code""invalidRequest",
  "message""Value \"\" can not be added to field \"pilot\" as it is not value input"

I'm not sure if this is a bug or intended change? Any ideas on a workaround?
4 Replies

@Norro1475 

You can exclude the field pilot in the json body, if you are not assigning any value.

 

To conditionally include a JSON body field named 'pilot' in a Graph API request from Microsoft Flow, you can use the "Compose" action along with an expression to check if the field contains data. Here's an example:

 

1. Add a "Compose" action before the "HTTP" action in your Microsoft Flow.

2. In the "Compose" action, use an expression to check if the field contains data. For example, you can use the following expression:

if(empty(outputs('pilot')), null, outputs('pilot'))

This expression checks if the 'pilot' output is empty. If it is empty, it returns `null`. Otherwise, it returns the value of the 'pilot' output.

3. Use the output of the "Compose" action in the JSON body of the "HTTP" action. In the "Body" field of the "HTTP" action, reference the output of the "Compose" action using the dynamic content selector (the expression should be something like `@{outputs('Compose')}`).

 

By using this approach, the 'pilot' field will only be included in the JSON body if it has any data. If it is empty, the field will not be included in the request.

 

By using conditional expressions in the "Compose" action, you can dynamically construct the JSON body based on the presence or absence of data in your fields.

 

If I have answered your question, please mark your post as Solved
If you like my response, please give it a like

@Deleted I do not want to exclude the field, I'm specifically trying to set it to be blank and override the default value!

@Norro1475 Try passing null value instead of "" to your choice field and see if it works for you.


Please click Mark as Best Response & Like if my post helped you to solve your issue. This will help others to find the correct solution easily. It also closes the item. If the post was useful in other ways, please consider giving it Like.

No, null no longer works either.

On further investigation it appears to be enforcing the predetermined choices where previously it was not. This prevents it being emptied by either means!

Huge bug IMHO. Restrictions should apply if it is filled, not prevent it being left/reset unfilled, there is another option for that.

option 2 is supposed to allow nulls, but is now totally ignored if tickbox 1 isn't chosen :(