web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Adding date and time s...
Power Automate
Answered

Adding date and time stamp to a pdf file name

(0) ShareShare
ReportReport
Posted on by 61

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.

Categories:
I have the same question (0)
  • Gristy Profile Picture
    2,429 on at

    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 Profile Picture
    61 on at

    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 Profile Picture
    2,429 on at

    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 Profile Picture
    61 on at

    I see this under Outputs>Body

     

    "receivedDateTime": "2019-09-20T22:34:12+00:00",
  • Gristy Profile Picture
    2,429 on at

    Hey, 

     

    please post a screenshot.

  • gm355 Profile Picture
    61 on at

    datetime.PNG

  • Gristy Profile Picture
    2,429 on at

    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

  • Verified answer
    gm355 Profile Picture
    61 on at

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

  • Verified answer
    v-bacao-msft Profile Picture
    on at

     

    Hi @gm355 ,

     

    Please try to use this expression:

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

     

    Best Regards,

  • gm355 Profile Picture
    61 on at

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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard