Tracking contact’s organization history in Microsoft Dynamics CRM Online

By - October 14, 2015

Have you ever come across a situation where a contact leaves a company but joins another company that is also your client? What do you do with all the notes and emails you have captured from his previous employer?  We recently came across a similar scenario where we were implementing Microsoft Dynamics CRM Online. The client mentioned that the employees (contacts) move frequently between companies. Their goal was to keep track of last three companies to which the an employee (contact) was associated along with their job title, position level and the date on which they changed companies.

On the surface, this tracking seems pretty straight forward at first glance via auditing. But, simple as it sounds, there are a lot more things to analyze about this scenario. In native Dynamics CRM, when the parent company (account) of a contact is changed, the child records (activities) will also move with it. For example when contact is changed from company A to company B, all the activities the contact performed at company A will move and roll up to the company B level. This roll up of activities, notes or contact’s child records is not an accurate representation of where this information was originally created from.

To handle this scenario for our client, we leveraged a custom entity sub grid on contact form, a custom JavaScript and a custom plug-in to keep the relationship between the records intact. The following is an example that illustrates our solution. Below is a sub grid on a contact form.

Tracking Contact’s organization history 1

  • When John Doe is created in the system with Company A as the company he works for, the plug-in triggers on save and creates row #1 in the custom entity. The record is then displayed in the sub grid with a lookup to the contact as a reference.
  • Row #2 – This is where the real magic starts to happen. On 5/1/2015 John Doe moves to Company B as a Business Analyst. The changes are made in Dynamics CRM and the record is saved.
  • On save, the custom JavaScript triggers and creates a new John Doe contact with the latest information. The script then deactivates the old John Doe contact record from Company A. Once that is completed a plug-in detects these changes and triggers one more time to create row #2 in the custom entity and reference it to the deactivated John Doe contact. It also copies row #1 from the inactive John Doe record sub grid and adds it to the sub grid on the new John Doe record of Company B.
  • Similarly, the JavaScript and plug-ins trigger for row #3 and #4.

In a nutshell, the custom entity will track the specific attributes you want to keep track of. The custom JavaScript will be used for cloning the contact. The custom plug-in will be used to keep track of changes of the attributes and creating new records in the custom entity. In addition, we have also added few fields on the contact form to reference back to the previous contact. For example if someone wants to review past information of the contact they can easily navigate to the deactivated contact by clicking on the predecessor and second predecessor contact field.

Tracking Contact’s organization history 2

With this approach you can keep track of your contact’s history. Along with that this approach it also covers the scenario where a contact changes multiple positions within a company. Not only that but you can keep the activities and other child record with the correct contact as the newly cloned contact record will always starts fresh at the new organization or company.

If you have a similar situation where the out of the box Dynamics CRM functionality needs to extended, please contact our professionals for more information on our services at 855.437.7202 or If you like these tips, consider subscribing to our Dynamics Community News publication.

By: Gaurav Chauhan – Virginia Microsoft Dynamics CRM partner

Receive Posts by Email

Subscribe and receive notifications of new posts by email.