Published On: May 13, 2022Categories: Technical

One of our colleagues recently had a requirement for having a dialog form with multiple toggle buttons to export several different files.

So, the standard procedure for exporting to CSV in D365 is:

  • to create a ‘CommaStreamIo’ object,
  • fill it with data
  • and then send a file to the user (File::SendFileToUser(stream, filename)) which file then gets downloaded from the browser.

However, the issue with this approach appears when we try to export multiple files with the same function, i.e. ‘File::SendFileToUser(stream, filename)’. In such a case, only the last file gets downloaded.

The solution to this is to use temporary storage, get the link from it and open it in a new tab:

CSV files blog post

 

We hope that this blog post is helpful, especially if you have found yourself in some simmliar situation. 

______________________________________________________________________________________________________________

If you are interested to join our team of Masters, check out our careers page, we have open positions for Microsoft Dynamics enthusiasts in every field. :)