Recently, I refreshed a client test database with a copy of their live database in Microsoft Dynamics NAV so they could test some functionality and do training. One of the issues that they ran into right away was that it became confusing for them to know which database and company they were accessing.
“What about the system indicator?” you say? Yep… they were already using that, and now both indicators looked the same. “So we could just open up the company information and change it.” You could, but we would have to do so for all 20-30 of their companies.
Instead, just use a processing report and a little bit of code to rename them and you’ve accomplished your task all with a few mouse clicks.
Basically it uses the system table Company, and cycles through it to get all of the Companies listed. Then it takes an input for the Indicator Type, Indicator Color and because I wanted to make the option of a prefix to the Company Name, a text input as well.
After creating a report with Company as the dataitem, make a request page with fields that contains matching options for the color of the indicator, and the indicator type. Because I wanted to give the Company Name a prefix I added a text field for the custom Text and made it required if the Indicator Type “Custom Text” was selected. You may want to change this depending on your needs.
Then add the following code in the OnAfterGetRecord section.
CompanyInformation."System Indicator" := IndicatorType;
IF IndicatorType = IndicatorType::"Custom Text" THEN
CompanyInformation."Custom System Indicator Text" :=
STRSUBSTNO('%1 - %2',InputString,Company.Name);
CompanyInformation."System Indicator Style" := Color;
When you run the report, it cycles through all of the companies in the database and adds the System Indicator with the System Indicator Style (Color) you selected.
For two of our particular clients it may save me 10-15 minutes each time we update their test system.
Not bad for 15 minutes of code.
Feel free to make any improvements or changes, as always we welcome comments below.