Change Left Nav Links to Point to Custom Associated Entities

In an earlier post, I talked about the shortcomings of the out-of-the-box Address entity. In a recent project, we replaced the system Address entity with a custom Address entity. When we added a 1:N relationship for Contacts:New_Addresses, the link to the new address entity showed up on the left hand nav of the Contact form, as expected. However, it was added at the bottom of the left hand nav links under the "Workflow" link.

We wanted to keep the Addresses link where it was, but load the associated view of our custom entity instead. So when a user clicks on the "More Addresses" link, they will see the list of custom address records, rather than the out-of-the-box addresses. Here's the OnLoad code we used:

// load the custom address entity instead of the system addresses
// in the associated view
// I used the IE Developer Toolbar to find the id of the custom entity's loadArea

if (document.getElementById('navAddresses') != null) { document.getElementById('navAddresses').onclick = function() { loadArea('new_contact_new_address') };

// Hide the link to the custom address entity that was added under the workflow link
// when we created the 1:N relationship

if (document.getElementById('nav_new_contact_new_address') != null) { document.getElementById('nav_new_contact_new_address').style.display = 'none';


Peter said...

Did you know that the custom relationship you created from Contact to Custom Address entity has settings for the left navigation?

You can change the Display option, Display Area, Custom Label, and Display Order. This should eliminate the need for the extra Java script other than the hide System Address entity.

Matt Wittemann said...

Yes, but there's no way to make your links for custom entities replace a built-in link or appear above other built-in left nav links without using custom code like this. you can re-order links to custom associated entities starting with an index value of 10,000; but the built-in links all have a hard-coded order value under 10,000.

ICU MSCRM © 2004-2009