Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Getting form attachment link as a variable

Like (0) ShareShare
ReportReport
Posted on 11 Sep 2023 12:53:53 by 5

I have created a powerautomate workflow that takes form responses from a form and then sends them as an email. One of the form response fields is an attachment where the user can upload a file.

 

When I try to add this form response to my powerautomate workflow I find that the variable value for the form gives a full string of JSON information rather than the form link itself. Is there a value in powerautomate that will output the form link only, without the rest of the JSON information?

  • munthazir Profile Picture
    6 on 12 Jun 2024 at 11:12:30
    Re: Getting form attachment link as a variable

    This also worked perfectly for me.

     

    But I have a situation, how do I grab the URL if there are 2 attachments?

  • ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 25 Sep 2023 at 13:33:07
    Re: Getting form attachment link as a variable

    Hi Scott,

     

    To handle the case when no attachment has been uploaded, pls use the below expression. It will return empty or blank string if no file has been uploaded:

    if(equals(outputs('Get_response_details_2')?['body/rd47769ed20514a3285ceba40cbc92cd4'],''),'',first(json(outputs('Get_response_details_2')?['body/rd47769ed20514a3285ceba40cbc92cd4']))?['link'])

    Pls replace outputs('Get_response_details_2')?['body/rd47769ed20514a3285ceba40cbc92cd4'] with the actual MS form field.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

  • ScottThompsonER Profile Picture
    5 on 25 Sep 2023 at 13:16:30
    Re: Getting form attachment link as a variable

    Hey Manish, 

     

    One more question, what can I do to allow this to enter nothing if there are no attachments? The current solution bugs and breaks the flow when there is no JSON attached.

     

    Thanks, 

     

    Scott

  • Verified answer
    ManishSolanki Profile Picture
    15,085 Super User 2025 Season 1 on 11 Sep 2023 at 13:27:11
    Re: Getting form attachment link as a variable

    Hi @ScottThompsonER 

     

    You need to write an expression to fetch the link of the file uploaded from MS form. Expression needs to be written in the expression box as shown below:

    ManishSolanki_0-1694438681344.png

    first(json(outputs('Get_response_details')?['body/r9b69c1c3a9104afc9921e582d7c3ae73']))?['link']

    pls replace outputs('Get_response_details')?['body/r9b69c1c3a9104afc9921e582d7c3ae73'] with the actual form field in the above expression. This will work if you have allowed only single file for user to upload.

    The output of compose action will give the required link.

     

    If this helps & solves your problem, please remember to give a 👍 and accept my solution as it will help others in the future.

     

    Thanks

     

     

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

🌸 Community Spring Festival 2025 Challenge 🌸

WIN Power Platform Community Conference 2025 tickets!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,651 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 65,997 Most Valuable Professional

Leaderboard
Loading started