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 :
Microsoft Dynamics AX (Archived)

How to save text / csv file from D365?

(0) ShareShare
ReportReport
Posted on by 6,470

Hello,

I have to export / save some field values during the posting of invoice.

I could not find guidance how is it possible to write data into file, which will be later saved / downloaded from system.

Could you please help me to go with correct direction? Which classes to use? How the files can be saved?

Thanks.

*This post is locked for comments

I have the same question (0)
  • pralay_kumar_das Profile Picture
    260 on at
    RE: How to save text / csv file from D365?

    Dear,

    dynamics365foroperation.blogspot.com/.../create-csv-file-and-save-it.html will guide you writing code to export data.

    By Chrome settings You can set it auto download where it will not prompt you to click the download icon and will be downloaded in default location. for this go to chrome settings and look download tab.

  • Verified answer
    Shahil Profile Picture
    635 on at
    RE: How to save text / csv file from D365?

    Hi 

    I've written a simple job that allows you to write data to a file and downloads it.

    https://dynamics365foroperation.blogspot.com/2018/02/create-csv-file-and-save-it.html

    You might find this helpful

    In your case, once the posting is done, you can simply create a new method that writes whatever data you want to a stream. Some of the classes you could use to write/read files is CommaStreamIo, CommaTextStreamIo, TextStreamIo. 

    For saving the file, either you can save it into a temporary blob storage and download it later or you can redirect user to a browser window to download. Have a look at FileUploadTemporaryStorageStrategy, FileUploadTemporaryStorageResult, FileUpload, FileUpload or the File class. 

    Find references on these and you'll find a lot of useful examples on how these are being used. 

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 2

#1
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

#1
Guy Terry Profile Picture

Guy Terry 2 Moderator

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans