Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Answered

create a plugin that return a file to the browser when clicking a button

(0) ShareShare
ReportReport
Posted on by 15

Hi,

I would like to create a button that will download an accounting file in the browser, as same as you export a view to an excel file.

The file format is a bit complex and I believe it would be easier to do it using a plugin in C#.

I can save the file in dataverse, as an email attachment etc... but I couldn't find anything about how to return the file to the browser.

Do you know if is it possible?

  • Charan Raju C R Profile Picture
    Charan Raju C R 7 Moderator on at
    RE: create a plugin that return a file to the browser when clicking a button

    If you don't like the mixed approach, you can implement it fully using javascript including a complex excel format and logic.

  • vnussbaum Profile Picture
    vnussbaum 15 on at
    RE: create a plugin that return a file to the browser when clicking a button

    Thank you for your responses.

    I also found you can use javascript to download the stored file but I don't like this way :)

    I feel it's a bit ..... to create a file, download it and then delete it.

  • Suggested answer
    Charan Raju C R Profile Picture
    Charan Raju C R 7 Moderator on at
    RE: create a plugin that return a file to the browser when clicking a button

    Hi vnussbaum,

    Since plug-in runs at server side, it cannot return the file to browser. But, from plug-in, you can save the GUID of the file attachment created in a field on parent record where you have a button. Few seconds after clicking button (you can use timeout) or on change of GUID field call a javascript function which downloads a file in the browser using the stored GUID.

  • Verified answer
    Guido Preite Profile Picture
    Guido Preite 54,073 Moderator on at
    RE: create a plugin that return a file to the browser when clicking a button

    you can't do with a plugin, you can do with a mix of JavaScript (that will be executed from the button click and return the file inside the browser) and a Custom Action (the server side code in C# to create the file)

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

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Vahid Ghafarpour – Community Spotlight

We are excited to recognize Vahid Ghafarpour as our February 2025 Community…

Tip: Become a User Group leader!

Join the ranks of valued community UG leaders

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,516 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,387 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans