Optional survey question causing Power Automate flow run failure

07-21-2021 01:28 PM
New Contributor III

Hi. I'm suddenly getting a Power Automate run failure on a "Send an email" flow. It's being caused by not answering an optional Time question:

The template language function 'formatDateTime' expects its first parameter to be of type string. The provided value is of type 'Null'.

I'm using a dynamic expression to reformat the returned value:

formatDateTime(triggerBody()?['feature']?['attributes']?['Start_Time'],'h:mm tt')

I'm hoping to not make this question required, but I can't think of a way to return a value other than Null for an unanswered Time question. Any suggestions? Thank you

0 Kudos
1 Reply
New Contributor III

I have absolutely NO experience with automated email services so most of that code is foreign to me, but couldn't you just set the default of the time your formatting (Start_Time?) to (now) or does that not return a string?  Definitely following this one...  

0 Kudos