cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

When my date is empty, its passed as an empty string and not as blank which gives an error

Hi, 

I am currently  working on a flow that updates data in CRM. (via Common Data Service)  One of the fields contains a date. This date can be empty or have a value. When the date has a value, it is parsed using formatDate().

 

As my date is stored in a variable, I'll also pass this variable on to CRM.

However, if my date is null, it will now automatically pass on an empty string as the date. This gives me the following error: "DateTime is less than minum value supported by CrmDateTime. Actual value: 01/01/0001 00:00:00, Minimum value supported: 01/01/1753 00:00:00"," because it transmits empty variable as an empty string.

Is it possible to make sure that I don't pass on an empty string but nothing at all? 

A solution can be to work with a set of conditions but this seems a bit cumbersome when you have several dates that can be empty.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: When my date is empty, its passed as an empty string and not as blank which gives an error

Hi @Esli 

 

In that case what you could do is generate the JSON Schema with all the elements. Pass your JSON results to schema step to validate it. Later in your step evaluate from the JSON flow step. Hope it make sense. If note send me the full JSON schema. I will try to put something together.



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

View solution in original post

3 REPLIES 3
Highlighted
Super User
Super User

Re: When my date is empty, its passed as an empty string and not as blank which gives an error

Hi @Esli 

 

Try using the expression function below

 

@not(empty(triggerBody()?['yourdatecolumname']))

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Highlighted
Frequent Visitor

Re: When my date is empty, its passed as an empty string and not as blank which gives an error

My response message will still have an empty string

{

     "OrderNo": "AB123",
     "StartDate": ""

}

 

I just wish it parsed without the date field. What the normal behavior is when a field is left blank.

 

{

     "OrderNo": "AB123"

}



Highlighted
Super User
Super User

Re: When my date is empty, its passed as an empty string and not as blank which gives an error

Hi @Esli 

 

In that case what you could do is generate the JSON Schema with all the elements. Pass your JSON results to schema step to validate it. Later in your step evaluate from the JSON flow step. Hope it make sense. If note send me the full JSON schema. I will try to put something together.



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

View solution in original post

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Users online (7,382)