cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
gm355
Level: Powered On

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
gm355
Level: Powered On

Re: Adding date and time stamp to a pdf file name

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

View solution in original post

Community Support Team
Community Support Team

Re: Adding date and time stamp to a pdf file name

 

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
Gristy
Level 10

Re: Adding date and time stamp to a pdf file name

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.

gm355
Level: Powered On

Re: Adding date and time stamp to a pdf file name

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?"

Gristy
Level 10

Re: Adding date and time stamp to a pdf file name

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.

gm355
Level: Powered On

Re: Adding date and time stamp to a pdf file name

I see this under Outputs>Body

 

"receivedDateTime": "2019-09-20T22:34:12+00:00",
Gristy
Level 10

Re: Adding date and time stamp to a pdf file name

Hey, 

 

please post a screenshot.

gm355
Level: Powered On

Re: Adding date and time stamp to a pdf file name

datetime.PNG

Gristy
Level 10

Re: Adding date and time stamp to a pdf file name

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

gm355
Level: Powered On

Re: Adding date and time stamp to a pdf file name

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

View solution in original post

Community Support Team
Community Support Team

Re: Adding date and time stamp to a pdf file name

 

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

gm355
Level: Powered On

Re: Adding date and time stamp to a pdf file name

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

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Watch the event on demand for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 Release Wave 2 Plan

Power Platform 2019 Release Wave 2 Plan

Features releasing from October 2019 through March 2020.

thirdimage

Flow Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Flow Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 336 members 1,605 guests
Recent signins:
Please welcome our newest community members: