Write to a CSV file and save it

This is a simple job I wrote in D365O that writes all customers where the DataAreaId is “USRT” to a CSV file and downloads it.
WriteToCSV
When you run the job you will be prompted to save the file.
SaveFile
Your saved file as CSV:
CSVFile

Comments

  1. Hi, this is nice snippet. I want to export CSV file every day at mid-night, can you please tell what's the good way to do this.

    ReplyDelete
  2. Hi Shubhrta, apologies for the late reply. You can create a recurring job in ax that runs every midnight.

    ReplyDelete
  3. Nice post. Thanks you very much for sharing. Quick question, can we store it a specific folder (if we configure a batch job) instead of giving an option to user to save the file?

    ReplyDelete
    Replies
    1. Since D365FO is web based, it doesn't have access to the file system. However, Microsoft has introduced Recurring Integrations Scheduler which can help you achieve that. I have a look at these links:
      https://github.com/Microsoft/Recurring-Integrations-Scheduler
      https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/recurring-integrations

      Delete
    2. Hi Shahil, But do you have links to examples of solutions to a similar task of saving files using the Recurring Integrations Scheduler in D365?

      Delete
    3. Have a look at this wiki: https://github.com/microsoft/Recurring-Integrations-Scheduler/wiki

      Delete
  4. Hi, I tried this sample code and it's working fine.

    Have you tried working on multiple files? Let's say one button that will generate 2 csv files to the client. Thanks!

    ReplyDelete
    Replies
    1. Hi Byron I haven't tried that out. It would be interesting to know how it behaves. Do tell if you have given it a go

      Delete
  5. hi, this is something i was trying to achieve this saves my time, but there is one thing i want to know when i am opening the file with edit option on notepad the file columns are in inverted comma, can you please let me know if there is separate class to get data without inverted comma?

    in note it is like "Hassan" in excel it is fine.

    ReplyDelete
  6. I'm attempting to do the same, but it's telling me that System.IO.StreamReader does not exist. Did Microsoft remove this? What would you do now that it's not available? Thanks!

    ReplyDelete
  7. CSV file save in non editable mode.

    I have generated csv file from data Gried view ,now i want to save csv file in readonly format.
    please help.

    ReplyDelete

Post a Comment

Popular posts from this blog

Override a System Defined Refresh button in D365O

Printing PDF Attachments in MSDyn365FO