Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

function to check valid date

(0) ShareShare
ReportReport
Posted on by 82

Need to work with dates my flow works perfectly if i have date value , but if date is empty my if(express,true-part,false-part) fails and go with the error "Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2321': 'In function 'formatDateTime', the value provided for date time string '' was not valid. The datetime string must match ISO 8601 format.'."

 

it works fine if i add Condition.issue date.jpg

  • SaiRaj3 Profile Picture
    6 on at
    Re: function to check valid date

    You can do Exception error handling in Power Automate flow by using Scope Control and Configuring run after properly,

    In Try Block of the Scope Control add that compose statement and in catch block configure it to run only when try is failed with a compose result('try') which has the Error JSON and add a Finally Block where you can check the length of that JSON identify if the Try has failed or not.

    SaiRaj3_0-1693570740778.png

    Best Regards,
    Sai Raj

     

  • Community Power Platform Member Profile Picture
    on at
    Re: function to check valid date

    If the datetime value format is not true, function formatDateTime() will be failed. How to resolve ?

  • Verified answer
    v-xida-msft Profile Picture
    on at
    Re: function to check valid date

    Hi @gunjan,

     

    Have your solved your problem?

     

    I agree with your thought almost, the formatDateTime() function requires its first parameter to be a datetime string which match ISO 8601 format, if you provided a empty value for the first parameter, the formatDateTime() function would fail.

     

    More details about the formatDateTime() function, please check the following article:

    formatDateTime() function

     

    You could consider take a try to add a Condition to check if the date value is empty, if yes, do nothing, if no, convert the date value using the formatDateTime() function:9.JPG

     

    If your problem is solved, please click "Accept as Solution" so that this thread will be marked for other users to easily identify if your problem is solved.

     

     

    Best regards,

    Kris

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,668 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,004 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow