Customizing Dynamics NAV
Discover different ways to customize the application to give you and your colleagues access to the features, functionality, and data that you need most.
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
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 and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
As you probably know, CaptionClass is a nice feature which is used from time to time in the customizations and it is the core of the standard functionality of Business Central. We can see it for example on the pages where dimensions’ names are displayed instead of the number.
In old days, if you wanted to have your own CaptionClass you could do one of two things. First, you could write your own function which would show the caption and declare it in the CaptionClass property. But for some reasons you needed to do that on the table and on the page – if you did it only in one place then it was not properly shown (especially if you wanted to customize the page).
Secondly, was modify the standard Codeunit CaptionManagement by adding code in below function. This is not possible anymore.
Since the Business Central Release Spring 2019 Codeunit CaptionManagement is completely changed. If you check it now, instead of 400 lines it has… 60. And most of it are the lines with the comments. Except the integration events, you will find there only two procedures. And both are local.
So where is the whole code for CaptionClass and how do you find how does it work now? You will find everything in new Codeunits – yes multiple Codeunits, not only one. Each of the CaptionClass area (1, 2, 3, 5 and 101) has got its own.
And when looking closer into those objects – there are two functions in each of them. One which is a subscriber to the event which I marked above (OnResolveCaptionClass) and second one which is the code responsible for the CaptionClass.
To show you how you can create your own CaptionClass I prepared an example. First I created a new table extension to the Item table and I added the fields on the Item Card.
As you can see I added CaptionClass to both my fields.
Afterwards, I prepared the Codeunit which contains two functions – one with the event subscriber which checks if CaptionArea is 50100, the same as in my table extension.
And second function which checks what is the second parameter in the CaptionClass right after the comma and returns the proper value. Of course, instead of the marked hardcoded values you should use the labels with translations.
And the result you can see in the below screen. On the Item Card I have two fields with my captions.
Business Applications communities