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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to pass dynamic fi...
Power Automate
Answered

How to pass dynamic file path in power automate?

(0) ShareShare
ReportReport
Posted on by 357

Hi, team 

I am passing dynamic file path 

But when I use file exist then it goes to else 

 

When I hardcode the path it show file exist

 

Path is like this c\ ....\%ordernumber%.docx 

Then shows file not exist

 

If I hardcode c\ord12455.docx 

Then file is exist

 

  • Riyaz_riz11 Profile Picture
    4,214 Super User 2026 Season 2 on at

    Hi @Sanket1 ,

    You are passing dynamic right, put that whole dynamic path into one display msg and check the path everything you are getting proper or not,

    If you are downloading any website then use wait for file.

     


    If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.

    Regards,
    Riyaz

     

  • CU16071609-1 Profile Picture
    6,255 Moderator on at

    @Sanket1 

     

    The below flow working fine for me:

    Deenuji_0-1709623224161.png

     

    Code:

    SET FileName TO $'''ord12455.docx'''
    IF (File.IfFile.Exists File: $'''C:\\Deenu\\%FileName%''') THEN
    Display.ShowMessageDialog.ShowMessage Title: $'''File Exists''' Message: $'''File Exists''' Icon: Display.Icon.None Buttons: Display.Buttons.OK DefaultButton: Display.DefaultButton.Button1 IsTopMost: False ButtonPressed=> ButtonPressed
    END

     

    If you have activated Power FX while creating your flow, then kindly deactivate it and recreate  new flow and testing the above logic.

    Deenuji_0-1709623734013.png

     

    -----------------------------------------------------------------------------------------------------------------------------

    If I've resolved your query, please consider accepting it as the solution and giving it a thumbs up to help others find answers faster.

     

     

  • Sanket1 Profile Picture
    357 on at

    How to keep it dynamic 

  • CU16071609-1 Profile Picture
    6,255 Moderator on at

    @Sanket1 

    You can input any value into the filepath variable below. In the "if" condition action, it will verify whether your file exists on your computer. If it does exist, the "if" action will be executed.

    Deenuji_0-1709625000510.png

    If you require additional details, please elaborate on your question by providing the correct examples and explaining what you mean by "dynamic" and so forth.

     

     

     

  • Sanket1 Profile Picture
    357 on at

    MyFlow 

    Var OrderNumer 1234 

    Save word file action

    Filepath......wordfile\orderNumber

     

    Word document got save in folder 

    1234.docx

     

    Now check

     

    If file exist 

    Var FilePath pass 

     

    Else executed but file is present in folder

  • CU16071609-1 Profile Picture
    6,255 Moderator on at

    @Sanket1 

    Pls share your flow screenshot if possible? Please confirm are you enabled power fx in your flow?

     

  • Sanket1 Profile Picture
    357 on at

    Not enabled 

  • Sanket1 Profile Picture
    357 on at

    Whenever I display path 

    The .docx extension show downside 

     

    Like

    C\.....\wordfile\1234

    .docx

     

    Not like this Like

     

    C\.....\wordfile\1234d.docx

  • Verified answer
    CU16071609-1 Profile Picture
    6,255 Moderator on at

    @Sanket1 
    Would you mind sharing a screenshot of your flow, please?

     

    Based on the provided information, it seems that there might be a line break or whitespace next to the filename, causing the extension to appear on the next line.

     

    I suggest using the trim or replace action to remove any unnecessary whitespace characters and ensure that your filename is properly trimmed.

    Deenuji_0-1709633807655.png

     

    Deenuji_1-1709633857890.png

     

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 237 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 194

Last 30 days Overall leaderboard