web
You’re offline. This is a read only version of the page.
close
Skip to main content
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?

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 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)

  • Suggested answer
    Charan Raju C R Profile Picture
    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.

  • vnussbaum Profile Picture
    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.

  • Charan Raju C R Profile Picture
    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.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 179 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 110

#3
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 61 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans