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:

Set(
    BlankChoice,
        {
            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),    
 Patch(TestList,SelectedItem,
    {
        TestField:BlankChoice
     }
 )
);

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.

Maurizio Marmotta

Maurizio Marmotta

Maurizio is a PMO Specialist at EPM Partners and has 25 years of experience in workflow software, data-driven decisioning tools, digital marketing.

You may also like

Get a Free Demo of pmo365

New Upcoming Online Events

Watch how microsoft pmo365 works in your industry

Learn how to manage your portfolio of projects in a centralised solution with Microsoft pmo365.

Limited time offer

Free 30-min
PPM audit

Review your existing projects portfolio data collection, tools, methods, current reports, dashboards, methodologies, frameworks and PPM best practices.