The views and opinions expressed in this blog are those solely of the author(s) and do not necessarily reflect Microsoft’s current policy, position, or branding. For official announcements and guidance on Dynamics 365 apps and services, please visit the Microsoft Dynamics 365 Blog.
Personalized Community is here!
Quickly customize your community to find the content you seek.
Now Available in Community - New TechTalk Videos for 2020
Read More about New TechTalks for 2020
2020 Release Wave 2Discover the latest updates and new features to Dynamics 365 planned through March 2021.
Release overview guides and videos Release Plan | Preview 2020 Release Wave 2 TimelineWatch the 2020 Release Wave 1 virtual launch event
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants. | Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements | ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
Writing data from a program to a text file using any programming language is a very common task for the programmers. It is also used while you are customizing or developing a new solution in Microsoft ERP systems such as Microsoft Dynamics 365 for Finance & Operations but it is pretty difficult to find out the code as this is not a very common task in ERP development.
It can be used in writing error logs, event logs, or data of different processes to a file to ship that data to someone else who needs data in text file with TSV format. Moreover, there are many and many different requirements that can be fulfilled using this code. Keeping that in mind, I have created this tutorial. Few days back, we have discussed about how to read data from TSV file using x++ in D365FO.
//Moeen Ahmed Sultan
//Microsoft Dynamics 365 for Finance & Operations
//Tel: +92 321 458 9595
public static void main(Args _args)
fileName = "C:\\TSVDataFile.txt";
IOPermission = new FileIOPermission(fileName, #IO_APPEND);//If you want to write after deleting previous data, use #IO_WRITE instead of #IO_APPEND
file = new TextIo(filename, #IO_APPEND);//If you want to write after deleting previous data, use #IO_WRITE instead of #IO_APPEND
//It will create one tab separated row/line in the text file.
cont = connull();
cont = conins(cont, 1, "Moeen");
cont = conins(cont, 2, "Ahmed");
cont = conins(cont, 3, "Sultan");
Note: The disk partition of your computer should have allowed write permissions in order to run this code.
I have run this job three time and the text file is as follows:
Note: If you found any ambiguity or a better solution, please comment.
Data file: TSVDataFile – Output
GitHub: Click here
YouTube Channel: Click here
Strong people don’t put others down… They lift them up. ― Michael P. Watson
The post Writing data to TSV file using x++ in D365FO appeared first on NevoiTech Blog.
Business Applications communities