Blog

SharePoint - How to clear datetime fields/set an empty datetime value on a form

A problem that some app builders encounter is that on edit forms, clearing the value of a datetime field doesn't work. This post describes this issue in more detail.

A very common requirement is to build data entry forms with non-mandatory datetime fields. Let's take the example of an edit form that's based on a SharePoint list of issues. This list includes an optional field called 'target close date'.

At runtime, the user edits an existing record with a 'target close date' and attempts to clear this by deleting the existing value in the date control.


When the user saves the record, Power Apps does not correctly clear the value and does not display any error messages. When the user subsequently opens the record, the old 'target close date' value still appears.

How to enable the ability to save null/empty datetime values

The simple and quick fix to this problem is to enable the "Formula-level error management" option in the settings of the app. It's necessary to reload the app for this setting to take effect.


With this setting enabled, the app will behave as expected, and users can correctly clear, or set datetime values to blank/null by clearing the value in the date picker control.

As a point of reference, the 'Formula-level error management' option is the setting that enables the ability to save null values. It's also the setting we would apply when we want to set a SQL Server field value to null by patching a Blank() value (which is another common issue that app builders encounter).

Conclusion

If you're unable to set a datetime value to blank or null, the fix to this problem is to enable the 'Formula-level error management' option in the settings of an app.