Set null value to Date field in Dynamics 365 CRM using PowerApps

By | March 12, 2020

Introduction

PowerApps lets you create, customize and run mobile apps with very less code. By using Dynamics 365 Connectors we can create mobile apps which can be shared within an organization. Users can run these apps in web browser and on their mobile devices.

In this blog, we will explore how to set null value in a CRM date field using patch function through PowerApps.

Scenario – There can be possibility wherein users may mistakenly enter date information in a wrong record via PowerApps and they may need to clear that value at a later stage.

In order to fix the above scenario we would suggest following steps:

Step 1: Add Date (“Birthday”) field on EditScreen from the data source as shown in the below screenshot.

Set null value to Date field in Dynamics 365 CRM using PowerApps

Step 2: Set the advanced properties of DataCardValue.

  1. If we want to keep default date placeholder empty instead of some random date, then keep “InputTextPlaceHolder” property blank.
  2. Set the “IsEditable” property to true to edit or change the date.

For your reference see the below screenshot.

Set null value to Date field in Dynamics 365 CRM using PowerApps

Set null value to Date field in Dynamics 365 CRM using PowerApps

Step 3: Now set the formula on “OnSelect” property of “Submit” button.

Patch(Contacts,

First(

Filter(

Contacts,

contactid = BrowseGallery1.Selected.contactid

)

),

{birthdate:If(IsBlank(DataCardValue45.SelectedDate),Blank(),DataCardValue45.SelectedDate)}

)

Set null value to Date field in Dynamics 365 CRM using PowerApps

Step 4: Make sure in App settings, the “Formula-level error management” under “Experimental features” should be enabled as shown in below screenshot.

Set null value to Date field in Dynamics 365 CRM using PowerApps

Note: These features might change, break or disappear with time, depending on the updates from Microsoft PowerApps team.

Conclusion

This way, we can set null date in CRM using patch function from PowerApps.

Free 70% of storage space in CRM with Attachment Management Apps!

Attach2Dynamics – Store and manage documents/attachments in cloud storage of your choice – SharePoint, Dropbox or Azure Blob Storage from within Dynamics 365 CRM.
SharePoint Security Sync – Robust and secure solution to integrate Dynamics 365 CRM and SharePoint Security Sync thereby ensuring secure access to confidential documents stored in SharePoint.