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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Need help fixing user ...
Power Automate
Answered

Need help fixing user input from form to create ISO8601 time

(0) ShareShare
ReportReport
Posted on by 10

Hi, all. I have a Flow that takes input from a form and creates a calendar event.  But Microsoft Forms doesn't allow me to force the input of a time to be valid, and so my flow keeps breaking when my users input times as 0830 or 8:30 instead of 08:30. Right now all I have is to string together the date (from a date picker so that's always fine) plus the "T" plus the inputted time, plus a trailing ":00".

What I need is the logic to parse what they put in the "start time" and "end time" (short text) fields of the form to check if they forgot the colon or the leading zero to fix what they put in so I can hand it off to Convert Time Zone and continue my script from there.

I don't really know how to edit the raw code under Flows, so I need the instructions in steps that I can put into the Flow GUI editor. I could do this in python, but I have no idea how to do a nested series of IFs looking at string contents/substrings in Flow.

I'm picturing code that basically says (in old fashioned pseudocode style):

IF the string contains a colon AND is 5 characters long THEN its fine, continue

  ELSE IF the string is 4 characters long:

     IF the string contains a colon, THEN it must be missing the leading zero, so add it and continue

      ELSE the string must be missing the colon THEN stick it in the third position and continue

 ELSE (the string is neither 4 nor 5 characters long) THEN send an email to the user (I have their address from the form) telling them we failed to record this event

 

Alternatively, if there's just a way to do the python equivalent of "try" and catch IF the ConvertTimeZone is going to fail, just send that email warning them without trying to fix their bad input and make them resubmit the form, that would also be an acceptable outcome, if not quite as user-friendly.

 

I have a very small user group who I don't expect to do really stupid things like put in starting times that aren't times at all so I don't need to check for input like AB:CD, but they can sometimes make more reasonable input mistakes like I described above.

 

Thank you very much for any help you can provide!

Categories:
I have the same question (0)
  • Verified answer
    eric-cheng Profile Picture
    5,171 on at

    Hi @mbelvadi ,

     

    For the first part of your question.  You will probably need to use a series of expressions to do what you want.  It won't be pretty though.  The below is just an example. 

    ericcheng_1-1631071883557.png

    Alternatively, you can look to use Forms Premium / D365 Customer Voice.  It allows you to set a custom restriction using regular expressions to validate content.  There is a cost though but just putting it out there as an alternative.

     

    In regards to the 2nd part of your question, you can use scopes to implement try/catch/finally logic or use 'Configure Run After' in your action properties to ask it to run only after the previous action was successful or failed.   Please refer to this here.

     

    ericcheng_2-1631072099562.png

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

     

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 608

#2
Valantis Profile Picture

Valantis 416

#3
11manish Profile Picture

11manish 348

Last 30 days Overall leaderboard