ArcherPoint Dynamics NAV Developer Digest - vol 54
The ArcherPoint technical staff—made up of developers, project managers, and consultants – is constantly communicating internally, with the goal of sharing helpful information with one another.
As they run into issues and questions, find the answers, and make new discoveries, they post them companywide on Yammer for everyone’s benefit. We in Marketing watch these interactions and never cease to be amazed by the creativity, dedication, and brainpower we’re so fortunate to have in this group—so we thought, wouldn’t it be great to share them with the rest of the Microsoft Dynamics NAV Community? So, the ArcherPoint Microsoft Dynamics NAV Developer Digest was born. Each week, we present a collection of thoughts and findings from the ArcherPoint staff. We hope these insights will benefit you, too.
Kyle Hardin on creating new companies in NAV:
I figured out a way to programmatically create a whole lot of NAV companies. At the client site, we are going to wind up with over 70 companies and while that is normally a Consultant Problem(TM) (and thus not anything I should or would ever care about :)) I decided to trade sleep for a better solution.
I created a new master table called Master Company (not-company-specific) and stashed the master list there. Then I wrote a small codeunit that loops through that and makes copies of the Golden Setup company, one by one, and even sets the correct name in Company Information.
Golden := 'Golden Settings'; IF COMPANYNAME <> Golden THEN ERROR(Text001, Golden); StartDateTime := CURRENTDATETIME; MasterCompany.FINDSET; REPEAT COPYCOMPANY(COMPANYNAME, MasterCompany."Company Name"); CompanyInfo.CHANGECOMPANY(MasterCompany."Company Name"); CompanyInfo.GET; CompanyInfo.Name := MasterCompany."Company Information Name"; CompanyInfo.MODIFY(FALSE); Counter += 1; UNTIL MasterCompany.NEXT = 0; EndDateTime := CURRENTDATETIME; MESSAGE(Text002, Counter, EndDateTime - StartDateTime);
Matt Traxinger: PowerShell can do the same thing with the NAV cmdlets. See the article below:
Kyle Hardin: I thought about going that route, but I already needed a company list in a NAV table for other reasons, so easier to just loop through that than have a 70 line powershell script. I also thought about calling PowerShell directly from NAV, which looks like it can be done, but I didn’t have the time to invest in figuring it out.
Matt Traxinger: The beauty of PowerShell is you don’t need a 70 line script. The Destination Company accepts piped in names, so you could do something like:
foreach $line in Get-Content "some file with your companies in it" | Copy-NAVCompany -ServerInstance "server" -SourceCompanyName "source company"
Since you need it for other things in NAV probably works better as a table.
Faithie Robertson shared an article on Dynamics NAV Upgrades:
Customers and pros both weigh in on the task of upgrading Dynamics NAV.
Rajasekhar Yedamakanti shared an article on upgrading best practices for Dynamics NAV 2013 R2 and 2015:
This article offers advice on a wide variety of upgrade issues, including synchronization, collation, data conversion, error codes, company names, and table indexes.
You can also read part 1 of this article here.
Adrian Gan explains how to give a comfortable green tint on Windows:
A Quick tip: How to switch your PC screen to green tint?
Feeling eyes discomfort after staring at the sharp white screen for a long time? Why not spend 2 minutes to change your screen color to a comfortable green tint? It especially works for people who work with the NAV Environment, as well as MS Office such as Word/Excel/Outlook. Below is the instruction of switching (they look “complicated”, but actually easy to perform).
For Windows 8/8.1 users:
1. Press Windows Key (Windows Logo) and letter key R at the same time (Wins+R shortcut) to open the “Run” box.
2. Type in “regedit” as a command and click “OK”. And then Click “Yes” in the pop-up warning message box.
3. In the Registry Editor panel, click following this path: HKEY_CURRENT_USER > Control Panel > Colors > Window.
4. Double click the “Window” item, and then change the “Value Data” to “204 232 207” (space between number). Then Click Ok.
5. Restart your PC. And your screen will look like the screenshots below.
Note: For Wins 8/8.1, the screen color returns back to sharp white if you log-in your PC again after locking/logging off your system. But every time you start/restart your PC, the changing becomes effective. Wins 7 users do not have this problem.
To change the settings back, follow the first four steps but change the “Value Data” back to “255 255 255”. Click OK and restart.
For Windows 7 users (much easier than Wins 8 users!):
1. Right Click > Personalize > Windows Color
2. Under the “Item:” dropdown list box, select “Window”. Click “Color 1:” right beside the dropdown list box, and then click “Other”.
3. On the color selection panel on the right, key in 85, 104 and 205 for Hue, Sat, and Lum respectively. And then click “Add to Custom Colors”. Click “OK”.
4. The system will automatically direct you back to the “Window Color” box, just click “Apply” and “OK”, wait for several seconds and you are good to go!
Michael Wong: You can also use the Color Picker Tool to find any color you want:
Figure 1. Switching your computer screen to a comfortable green tint saves on eye strain.