Updating SharePoint Fields to Null using Canvas App

A common scenario while using a canvas application would be to edit a previously saved records and save it back to the data source.

If the data source is a SharePoint list, the updated value is null and the field data type is either a Date, Choice or Person, there are some unexpected results. The field does not get updated to null and SharePoint still displays the old values.

A quick fix to the problem would be to turn on Formula-level error management option under Experimental features in your Canvas application.

To do that, edit your Canvas application and go to File-> Settings-> Advanced Settings and scroll down to Experimental Features and turn on the option for Formula-level error management.

Since the fix is using an experimental feature there may be cases where the issue is not resolved using the above method.

One solution would be to check for blank values on the Canvas application and manually patch SharePoint field with a blank variable.

As an example, a blank variable can be defined in OnVisible of the form, which can then be used to update a choice field like below:

            Id: -1,
            Value: Blank()

Before saving the data back to SharePoint check the value for the Combo box and execute a patch statement as shown below:

If (IsBlank(cboTestField.Selected.Title),    

Similar checks and patch statements can be performed for Person (For Person datatype a table needs to be created with blank () fields) and Date fields.



You may also like

Get a Free Demo of pmo365