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 Apps / Can I save the generat...
Power Apps
Answered

Can I save the generated PDF as an attachment inside a list item

(1) ShareShare
ReportReport
Posted on by 1,857 Season of Giving Solutions 2025

I have a SharePoint list form which have attachments + the below formula to generate PDF:-

 

 

Set(
 varWorkOrderPDF,
 PDF(
 'PDF container',
 {ExpandContainers: true}
 )
);

 

 

 

When submitting the form, i am generating the PDF, but how i can add the generated PDF as an attachment inside the list item? can i do it inside the power apps?

 

When i added the following formula inside the Items property of the attachment control:-

 

johnjohnPter_0-1699972535075.png

 

and i submit the form, i will get an error that the "Field 'id' is required", as follow:-

 

johnjohnPter_1-1699972565247.png

any advice? Thanks

 

Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    154,930 Most Valuable Professional on at

    Hi @johnjohnPter ,

    I do not believe you can do it directly in Power Apps, however if you look at the second option in this blog of mine and send the ID of the record as well, you should be able to add the file as an attachment (instead of emailing it as in the blog).

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Verified answer
    RouxJMM Profile Picture
    on at

    Try this.

    Set(varAttachment, { DisplayName: Substitute("FileName" & Text(Now(),"yyyy-mmm-dd hh:mmm AM/PM") & ".pdf", ":","_"), Id: Substitute("FileName" & Text(Now(),"yyyy-mmm-dd hh:mmm AM/PM") & ".pdf",":","_"), Value: Substitute(JSON(varWorkOrderPDF,JSONFormat.IncludeBinaryData),"""","")});

    and set the items to

    varAttachment

     

  • johnjohnPter Profile Picture
    1,857 Season of Giving Solutions 2025 on at

    @RouxJMM this worked thanks a lot 🙂 

  • johnjohnPter Profile Picture
    1,857 Season of Giving Solutions 2025 on at

    @RouxJMM this top working 2 days ago, where the PDF will not get added to the attachment control ? any advice?

  • RouxJMM Profile Picture
    on at

    Still works for me. Make sure the PDF function is enabled in the settings.

  • johnjohnPter Profile Picture
    1,857 Season of Giving Solutions 2025 on at

    @RouxJMM why saving it as an attachment might not be the best approach? can you elaborate more please?

  • CuriousCat_ Profile Picture
    on at

    Hello, where exactly should I put this ?

    Set(varAttachment, { DisplayName: Substitute("FileName" & Text(Now(),"yyyy-mmm-dd hh:mmm AM/PM") & ".pdf", ":","_"), Id: Substitute("FileName" & Text(Now(),"yyyy-mmm-dd hh:mmm AM/PM") & ".pdf",":","_"), Value: Substitute(JSON(varWorkOrderPDF,JSONFormat.IncludeBinaryData),"""","")});

     Thank you

  • WarrenBelz Profile Picture
    154,930 Most Valuable Professional on at

    @johnjohnPter ,

    I just posted a working solution on this thread.

  • RouxJMM Profile Picture
    on at

    It goes after the PDF has been created. It could go like this:

     

    Set(

        varWorkOrderPDF,

        PDF(

            'PDF container',

            {ExpandContainers: true}

        )

    );

     

    Set(varAttachment, { DisplayName: Substitute("FileName" & Text(Now(),"yyyy-mmm-dd hh:mmm AM/PM") & ".pdf", ":","_"), Id: Substitute("FileName" & Text(Now(),"yyyy-mmm-dd hh:mmm AM/PM") & ".pdf",":","_"), Value: Substitute(JSON(varWorkOrderPDF,JSONFormat.IncludeBinaryData),"""","")});

     

    and set the items property of the attachment control to:

    varAttachment


    If the content worked / was useful, please consider giving it Thumbs Up

  • VaibhavBhardwaj Profile Picture
    8 on at

    Thank you very much!! Its working flawlessly, I was able to capture the whole form (long scrollable form) as the PDF and save it as attachment in the list.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard