Customization and programming tricks by Ronny Van der Snickt

Show subordinate records after merging accounts

First create an IFrame on your form, this will contain the associated view. In my case I’m using the account entity.

Add the following lines of javascript code to the OnLoad of your account, this will show the associated view in the iframe.

 

var CRM_FORM_TYPE_CREATE = 1;

var CRM_FORM_TYPE_UPDATE = 2;

var CRM_FORM_TYPE_READONLY = 3;

var CRM_FORM_TYPE_DISABLED = 4;

var CRM_FORM_TYPE_QUICKCREATE = 5;

var CRM_FORM_TYPE_BULKEDIT = 6;

var url = ‘/’ + ORG_UNIQUE_NAME + ‘/sfa/accts/areas.aspx?oId=’ + crmForm.ObjectId + ‘&oType=1&security=852023&tabSet=account_master_account’;

switch (crmForm.FormType) {

    case CRM_FORM_TYPE_CREATE:

        break;

    case CRM_FORM_TYPE_UPDATE:

        crmForm.all.IFRAME_MergedFromIFrame.src = url;

        break;

    case CRM_FORM_TYPE_READONLY:

        crmForm.all.IFRAME_MergedFromIFrame.src = url;

        break;

    case CRM_FORM_TYPE_DISABLED:

        crmForm.all.IFRAME_MergedFromIFrame.src = url;

        break;

    case CRM_FORM_TYPE_QUICKCREATE:

        break;

    case CRM_FORM_TYPE_BULKEDIT:

        break;

}

 

De URL contains the entity type code 1 (1 =accounts) and the name of the relation.

So far this will show us an iframe containing a grid. There is one more thing we need to do. Because by default the associated views will only show active records therefore the grid will always be empty. To fix this we need to do one of the following 2 solutions.

Export the customizations, change the customization xml and import it again. Explained by Ronald Lemmen

Or

Using a plugin explained on Georged CRM Blog

After we made the changes to show disabled records the subordinate records are visible on the account.

Write a comment