Skip to main content

Notifications

Microsoft Dynamics CRM forum
Unanswered

Insert null value in DateTime field through an action

Posted on by 10

I try to insert an empty value for a DateTime field. This field is optional in my action. 

I call this action from a Logic App, through the HTTP Post step. In my body I have valid Json including the field: (this is a part of the complete message)

{

"enddate":""

}

With all kinds of alternatives I tried, but every time I get tis error:

DateTime is less than minumum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00"
In my Action this is the error message: (which is actually the same error)
Sync workflow failed with error message - Exception type: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]
Message: DateTime is less than minumum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00
  • Giorgio Zanoni Profile Picture
    Giorgio Zanoni 70 on at
    RE: Insert null value in DateTime field through an action

    Hi,

    I guess that the problem is that DateTime is not nullable and the default value is 01/01/0001.

    You can add a new field in the action to distinguish if the datefield is filled or not and consequently update the CRM entity.

    So:

    1. if the new filed "datepassed" is true and the field "enddate" is equal 01/01/0001 this means that in the action you have to pass "enddate" = null in the attribute collection, if "enddate" is <> 01/01/0001 you have to add "enddate" with the new datetime value

    2. if the new filed "datepassed" is false you don't have to add "enddate" attribute to the collection.

    It seems to be a mess but it should work... ;-)

  • RobJoosen Profile Picture
    RobJoosen 10 on at
    RE: Insert null value in DateTime field through an action

    Hi Guido,

    Thanks,

    I have tried :

    -"enddate": ""

    -"enddate": null

    -"enddate": null as expression

    - leave enddate out as parameter

    All with the same result.

    The only thing that works as a workaround is to use the Coalesce function and fill the date with a value of 1753-01-01 and use a post-action to clear this date. But I think that's a very dirty way of working.

  • Guido Preite Profile Picture
    Guido Preite 54,063 Moderator on at
    RE: Insert null value in DateTime field through an action

    try to write null instead of ""

    so

    {

    "enddate": null

    }

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Dynamics 365 Community Update – Sep 16th

Welcome to the next edition of the Community Platform Update. This is a weekly…

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,522 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,441 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans