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.
When you run the job you will be prompted to save the file.
Your saved file as CSV:
When you run the job you will be prompted to save the file.
Your saved file as CSV:
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.
ReplyDeleteHi Shubhrta, apologies for the late reply. You can create a recurring job in ax that runs every midnight.
ReplyDeleteNice 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?
ReplyDeleteSince 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:
Deletehttps://github.com/Microsoft/Recurring-Integrations-Scheduler
https://docs.microsoft.com/en-us/dynamics365/unified-operations/dev-itpro/data-entities/recurring-integrations
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?
DeleteHave a look at this wiki: https://github.com/microsoft/Recurring-Integrations-Scheduler/wiki
DeleteHi, I tried this sample code and it's working fine.
ReplyDeleteHave you tried working on multiple files? Let's say one button that will generate 2 csv files to the client. Thanks!
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
Deletehi, 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?
ReplyDeletein note it is like "Hassan" in excel it is fine.
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!
ReplyDeleteCSV file save in non editable mode.
ReplyDeleteI have generated csv file from data Gried view ,now i want to save csv file in readonly format.
please help.