Please note: It is not possible to set up custom n:n-relations by using the tree view of the RecordCounter Server Config!
Instead, you have to use the Configuration Tool. To do so, click on the [Configure RecordCounter]-button to open it.
Figure 1: RecordCounter Server Config
The following window (Figure 2) will appear. First of all, you must add a new navigation-item to the list in the Navig Item-area. This can be done with a click on the [Add]-button
Figure 2: Record Counter - Configuration Tool
Figure 3: Add Navigation Item-window
To find out the right name for the entry, just follow these instructions:
Open a CRM-record, which includes the related entity in the navigation bar.
By pressing the [F12]-button (or Extras -> Developer Tools) the Developer Tool will appear.
Here, click on the cursor in the upper left area of the tool. After that, switch back to CRM and click on the menu item (for which RecordCounter should be configured).
The html-code of that menu item will be displayed and highlighted in the Developer Tool.
Now you only have to search through the highlighted selector for the attribute id. The value of the id is the name of the new config entry.
Figure 4: Developer Tool
The next step is to build your custom fetch.
The easiest way to build a fetch is by using a fetch generator, e.g. Stunnware Tools. Additionally, there is a solution available that allows you to execute a fetch directly from CRM. This can be very helpful for testing. The following article describes how this can be used: Link to article.
As main entity for the fetch, select the entity for which you want to enable the RecordCounter. In this case it is product. You must only add the id-attribute to it (productid).
Next, you have to add a link to the parent entity. In our example, we add Contact.
Finally, you have to add a filter and a condition. The reason for this condition is that only records linked with the current parent entity should be counted.
The attribute of the condition has to be the id-attribute of the parent entity. It is contactid in this case. For value type in [GUID]. The RecordCounter will replace it with the calling parent entity-id.
<fetch mapping="logical" distinct="true" version="1.0">
<li name="new_contact_product" from="productid" to="productid">
<condition attribute="contactid" operator="eq" value="[GUID]">
Next, select your new navigation entry in the config and focus the Additional Fetches-area. Click on the [Add]-button
Figure 5: Record Counter Configuration Tool
Now the following window will appear. Include your fetch in the Fetch-XML-field.
And add the EntityTypeCode of the parent entity to Fetch-Type. In this example, the parent entity is Contact and its EntityTypeCode is 2.
Click on the [OK]-button in order to proceed.
Figure 6: Add Fetch-XML
With a click on the [Save]-button on the config, all settings will be saved and the configuration is completed.
Only if the RecordCounter doesn’t work for the new navigation entry, try to restart the Microsoft Dynamics CRM Sandbox Processing Service on the CRM server.
That’s it! We appreciate your feedback! Please share your thoughts by sending an email to firstname.lastname@example.org.