cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

Adding date and time stamp to a pdf file name

Apologies for the beginner question, I'm new to Flow and don't have much coding experience.

 

I have a Flow that extracts pdf's from an email and adds a date and time stamp. 

 

This is the code I'm using, I've used this before successfully.

 

concat(formatdatetime(triggerBody()?['DateTimeReceived'],'yyyy-MM-dd-hhmmss - '),item()?['Name'])

 

This is the error message I'm getting:

 

InvalidTemplate. Unable to process template language expressions in action 'Compose' inputs at line '1' and column '2665': 'The template language function 'formatdatetime' expects its first parameter to be of type string. The provided value is of type 'Null'. Please see https://aka.ms/logicexpressions#formatdatetime for usage details.'.

 

Any help would be much appreciated.

Thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted

Thanks, got the variable, now just need to concat it into the file name.

View solution in original post

Highlighted

 

Hi @gm355 ,

 

Please try to use this expression:

concat(formatDateTime(triggerBody()?['receivedDateTime'],'yyyy-MM-dd-hhmmss-'),item()?['Name'])

 

Best Regards,

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

View solution in original post

10 REPLIES 10
Highlighted
Super User II
Super User II

Hey there,

 

If you inspect your flow trigger, what is showing up under the DateTimeReceived variable? It looks as if it is blank and therefore this is why the flow is erroring.

 

You could use utcNow() expression and a "Convert timezone" action to convert into you rlocal timezone if you just need the time the flow action is  run.

Highlighted

Hi @Gristy ,

 

Sorry, how do I do this? I'm new to Flow.

 

"If you inspect your flow trigger, what is showing up under the DateTimeReceived variable?"

Highlighted

hi,

 

Open your failed flow where you copied the error from, and click on the top box i.e. the trigger.

 

this will show you the values passed to your flow.

Highlighted

I see this under Outputs>Body

 

"receivedDateTime": "2019-09-20T22:34:12+00:00",
Highlighted

Hey, 

 

please post a screenshot.

Highlighted

datetime.PNG

Highlighted

Thanks,

 

If you add a compose action and paste: @{triggerBody()?['DateTimeReceived']}

 

Inspect the compose action after a test to see ift he varaible is displaying OK

Highlighted

Thanks, got the variable, now just need to concat it into the file name.

View solution in original post

Highlighted

 

Hi @gm355 ,

 

Please try to use this expression:

concat(formatDateTime(triggerBody()?['receivedDateTime'],'yyyy-MM-dd-hhmmss-'),item()?['Name'])

 

Best Regards,

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

View solution in original post

Highlighted

Thanks, this worked as well. Not sure why my code above didn't work, it was very similar.

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (12,404)