web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / 'Create a task' does n...
Power Automate
Unanswered

'Create a task' does not accept null or empty string in date fields

(0) ShareShare
ReportReport
Posted on by 19

I am using 'Create a task' flowstep to generate tasks in a Microsoft Planner. But sometimes I do not want to enter a date value for the start or end date. It depends on a variable being entered or not. I use the following expression:

 

if(empty(variables('StartTime')),null,variables('StartTime'))

 

It returns a 400 error, bad request, stating that it was impossible to convert null to a datetime, which is correct. But I do not want to enter anything at all. I've also tried the following:

 

if(empty(variables('StartTime')),'',variables('StartTime'))

 

Same result, only this time it couldnt convert the empty string. Funny thing is, when I do not enter anything at all, it seems to be fine.

 

How do I go about making these datefields variably entered or left empty?

Categories:
I have the same question (0)
  • Hardesh15 Profile Picture
    7,087 Super User 2024 Season 1 on at

    @PresidentWillem 

    May i know how you add Date & time filed in a variable. Please share screen.

    Thanks

    Hardesh

  • v-litu-msft Profile Picture
    on at

    Hi @PresidentWillem,

     

    Yes, if there are some expressions in the StartDate field of Create a task action, there should contain a valid date, or it will report an error.

    As a workaround, you could create a condition action to determine the startdate variable whether empty, if it is empty, go to the branch that create task action which startdate filed leave empty, for example:

    Annotation 2020-07-15 141903.jpg

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • PresidentWillem Profile Picture
    19 on at

    Thanks for your answer, although this does not seem like a good enough solution.

    Because next up is EndDate, so then you would have to make 2 additional conditions within your given solution. I mean, that would probably work, but that can't be the right way to approach a simple problem like this, right?

  • v-litu-msft Profile Picture
    on at

    Hi @PresidentWillem,

     

    Yes, it is a workaround that not make users confused through it is a little complex.

    There has a another way, if the StartTime is empty, set the time to a invalid time:

    if(empty(variables('StartTime')),'1900-01-01',variables('StartTime'))

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • PresidentWillem Profile Picture
    19 on at

    I have checked your solution but it results in the following error:

     

    Schema validation has failed. Validation for field 'StartDate', on entity 'Task' has failed: The value must be between 1/1/1984 11:00:00 AM +00:00 and 12/31/2149 11:00:00 AM +00:00 inclusive.
    Validation for field 'DueDate', on entity 'Task' has failed: The value must be between 1/1/1984 11:00:00 AM +00:00 and 12/31/2149 11:00:00 AM +00:00 inclusive.

  • Verified answer
    v-litu-msft Profile Picture
    on at

    Hi @PresidentWillem,

     

    Ok, so the min time is 1/1/1984 11:00:00 AM +00:00, you could use this timestamp instead of 1900/01/01.

     

    Best Regards,
    Community Support Team _ Lin Tu
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard