As an early Xmas gift I’m releasing the Navigation UI Record Counter add-on for free on CodePlex.
This is a fully supported solution, there are no tricks involved in displaying the record count. We’ve used the out of the box Xrm.Page.navigation methods to set the label. This record counter will show you the number of active records of the desired related entity.
If you’re interested in learning how this works under the covers read on, otherwise download it from http://uirecordcounter.codeplex.com. There are couple of steps you need to take in order to get it up and running, please see the documentation tab for more detail, otherwise contact us and we’ll be happy to help.
Under the Covers
Once you import the solution you can call a function that’s part of uirecordcounter.js web resource called “UIRecordCounter.Counter.displayCount”, this takes in a single parameter that allows you to specify which navigation items to display the record count in. Syntax of the parameter is:
Navigation item names can be found via IE Developer Tools (F12). Entity schema name is the related entity schema name, eg: if you want to display the activity count for an account record the entity schema name is “activitypointer”. The foreign key schema name field is where the current record (contact) primary key is stored, in the example of activities this can be “regardingobjectid”.