cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
gm355 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
gm355 Helper I
Helper I

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
Community Support

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
Super User
Super User

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 Helper I
Helper I

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

Super User
Super User

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 Helper I
Helper I

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",
Super User
Super User

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

Hey, 

 

please post a screenshot.

gm355 Helper I
Helper I

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

datetime.PNG

Super User
Super User

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 Helper I
Helper I

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
Community Support

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 Helper I
Helper I

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
Did you attend MBAS? Claim your badge

Attending MBAS? Claim your badge

Whether you’ve streamed the digital event live, or you're watching on-demand, claim your attendee badge to sport on your profile.

MBAS Gallery 2020

MBAS Gallery 2020

Watch Microsoft Business Applications Summit sessions on-demand.

firstImage

New Ranks and Rank Icons released on April 21!

The time has come: We are finally able to share more details on the brand-new ranks coming to the Power Automate Community!

firstImage

Now Live: Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

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

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Users online (5,452)