cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Derek4
Resolver I
Resolver I

How to generate PDF file with date and time as file name

Hi everyone,

 

I'm build a flow which capture the user input to a word template and then convert the word file to PDF, everything is ok until I try to add date and time to the file name. I use this expression as my file name:

 

 

FormatDateTime(utcNow(),'s')

 

 

this is how my flow looks:

微信截图_20210608112929.png

 

 

this is the error details:

 

微信截图_20210608113033.png

 

this is the input of the "convert word to pdf" action

微信截图_20210608113351.png

 

I think it the space in the file name that prevent the action to access the file, but I don't how to get rid of them, can anyone help me?

2 ACCEPTED SOLUTIONS

Accepted Solutions
NiloferA
Solution Supplier
Solution Supplier

Hello @Derek4 ,

Can you change your expression to FormatDateTime(utcNow(),'dd-mm-yy') and try if it works?

In case if it does not, please expand the individual actions within the scope and post screenshots and also the error you may get after trying this out.

View solution in original post

Hi @NiloferA ,

 

I tried this:

concat('-Print-Date-',FormatDateTime(utcNow(),'yyyy-MM-dd'),'-Time-',FormatDateTime(utcNow(),'hh-mm-tt'))

 and everything is ok now, looks like generate PDF action must use '-' to work and can't have empty space...

View solution in original post

4 REPLIES 4
NiloferA
Solution Supplier
Solution Supplier

Hello @Derek4 ,

Can you change your expression to FormatDateTime(utcNow(),'dd-mm-yy') and try if it works?

In case if it does not, please expand the individual actions within the scope and post screenshots and also the error you may get after trying this out.

Hi @NiloferA ,

 

thank you for your reply and it works, I'm now one step closer to what I need!

 

is it possible that I add not only date but also time to the file name?

Hi @NiloferA ,

 

I tried this:

concat('-Print-Date-',FormatDateTime(utcNow(),'yyyy-MM-dd'),'-Time-',FormatDateTime(utcNow(),'hh-mm-tt'))

 and everything is ok now, looks like generate PDF action must use '-' to work and can't have empty space...

NiloferA
Solution Supplier
Solution Supplier

Hello @Derek4 ,

That's great! 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,684)