Fastest way to get entities in Dynamics NAV or Business Central and not only
Silviu Virlan
Microsoft MVP | MCT | Author | Dynamics 365 Business Central Supervisor at RSM US LLP | ERP, Dynamics NAV Expert
It's 4 pm. To my surprise a skype call from one of the customers I usually talk maybe once a month. She cut the niceties quite abruptly: "Look, I have a list of 100 customers and I need it in production asap. I have 15 fields with data for each new customer. Can you do it today before 5?"
This is the context of this blog post. How do we inject new entities in NAV, and not only, in the fastest way (under one hour) ?
A few weeks ago I engaged a few of my peer developers, not just NAV developers, on what they usually do in this type of scenario.
Some of their answers were really good and could be applied in Dynamics NAV or Business Central.
One of the answers was to ask the customer to enter it manually:)
That is indeed one way, but I'm not sure if my customer was willing to do it and - under one hour was out of the question.
Another answer was to "quickly" write an integration tool to take the data from the original system and push it into the target system.
Some of the answers I recall: "That's crazy!" or "You have a list!" or "Under one hour, please!"...
Another idea was to manipulate the list, residing in an Excel file, in such a way that we generate the code required to insert the records in the language of your choice (C/AL, AL, C#) and once generated copy it from Excel worksheet straight into a Run trigger of a codeunit or any other method and execute that method. For Business Central create a new extension, extending only Customer List page with one action "Import Customers" and drop the code generated in Excel in that action OnAction trigger. Install the extension, run the action, un-install extension. I personally used this method at least a dozen times in my career in different environments including NAV. It's fast, dirty and does the job :)
A similar answer was to generate the "INSERT INTO" t-sql statements in Excel and copy the batch in a query window and execute it. We know this is not what we call best practices when working with Dynamics NAV, not to mention Business Central. But this might work very well for other environments, especially when you don't have to trigger any business logic.
Another answer was to write in the language one prefers a subroutine to manipulate the Excel file programmatically. While this is a method that works most of the time when you have enough time, I don't think is doable in under one hour unless you already have the bulk of the code and you just need to quickly transform it and polish it for the fields that the customer is including this time. I used this method a few times in Dynamics NAV when one can take advantage of the structure Microsoft put in place since NAV 2013 via table 370 Excel Buffer.
One last answer discussed between the two NAV guys was to use RapidStart services. We, the NAV people, are quite lucky to have the mothership design this service for us. We both agreed that this would be one quick way to get the data in and most likely under one hour.
This is what I gathered for this type of time-sensitive requests. What would you do if you encounter this type of task?