When developing a custom add-on for Dynamics NAV, working with a DTAP or DTP roadmap can ensure both stability in your production environment on one end, and no limitations to develop freely on the other end. However, for key-users, consultants and developers, DTAP environments come with a risk: You might find yourself testing in live, or entering live data into a development, test or acceptation database by accident. Although I would never miss the opportunity to make fun of you if you did, I must admit it happens to me too 🙂
Even without accidents happening, with multiple instances of the same program open in the taskbar, all the buttons can get very confusing.
In order to minimize these risks within our company, we defined colours for every step: Red is development, green is test and blue is production (we don’t have an acceptance database at the moment). We used the system indicator (in Company Information) to show these colours in the program, too, but the taskbar problem was still there.
After some fiddling, we now have a fix for this:
Aside from being nice and colourful, this is quite easy to create and deploy too. The steps I took (skip to #3 if you want to choose different icons – there’s a lot to find for free):
#1 Get the NAV image as an .ico file
I used a small freeware program called NirSoft IconsExtract to get the .ico file from the Dynamics NAV executable. The executable to search for is in the RoleTailoredClient folder in Program Files (x86), in Microsoft.Dynamics.Nav.Client.exe.
#2 Change the colour of the icon
Another free tool was used to change the colour of the icon: GNU Image Manipulation Program (better known as GIMP), which is a very powerful image editor (open source and free!).
When opening the icon in this tool, on the right side of your screen you’ll see the layers. What I did was select the top layer, then click Colors > Map > Color Exchange.Choose Color From and Color To (you can do this quickly with the droplet tool), play a bit with the threshold until the example looks about right and click OK. Then hide the current layer, select the next layer and press Ctrl + F (command to redo the previous Color Exchange).
When you’re finished, make all layers visible again and click File > Export As… > Microsoft Windows Icon (.ico). You can ignore the warning if you’re running Windows 8.1 or 10 (it will read your icon with compressed layer without any problems).
#3 Creating desktop links that use your new icons
It’s NAV, and we want to deploy easily… so we use PowerShell for this! First, we need to set some variables and copy the icons to the Dynamics NAV folder:
Useful to know here: I used the public desktop folder to place the icons. When you want these in personal folders, use $Home\Desktop
Then, we ask the Windows Scripting Host to create an icon for us (copy this part for every environment you wish to link to):
Of course, we can also create a link on the desktop to the standard NAV environment (this uses the config file, and is essentially equal to the link on the Start Menu):
If you wish to change the behavior of your NAV client with command line arguments, you can add them in the $Shortcut.Arguments parameter. The way the link is configured now, everything except running the standard NAV environment will give you this security notice: