Displaying inactive records in associated view

In some situations you do want to show the inactive records in an associated view as well. My fellow MVP George Doubinski wrote an article about how to solve this by using a plugin:

In this post I will show that there are more routes to Rome. I've looked into the option of editing the query which is being executed against CRM. This seemed to be more easy then expected. What I did is:
- Export Customizations for the specific entity
- Open the XML file with a text editor
- Look for the section ""
- Look for the saved query with the localized name of the associated view
- In that saved query look for the filter that is specified in the columnset
- Remove the filter
- Save the Customizations file
- Import the Customizations file
- Publish the Customizations

Here's an example:

<ImportExportXml version="" languagecode="1043" generatedBy="OnPremise">
<Name .... />
<columnset version="3.0">
<!-- Delete from here -->
<filter type="and">
<condition column="statecode" value="0" operator="eq" />
<!-- Delete till here -->

Keep in mind that you do add the attribute StateCode or StatusCode to the associated view as well, so that end users can see which records are current and which are inactive.

One of the locations that this is useful, is when you are looking into relationships. The out of the box entity does allow you to select party 1, party 2, role 1 and role 2, but no real extensibility options. You could recreate that entity and add useful attributes like startdate and enddate. As soon as the end date has passed, then the record can be deactivated by using workflow. The fact that a person had a professional relationship with a company is information that you do want to keep visible, especially in the associated view.


sumedha Obeysekera said...

Thank you very much, this article helped me so much.. this works.

xster said...

Excellent discovery!
It works brilliantly and is so much less messy than George's (with all respect) method.


Unknown said...

Splendid post this one. When I first got the task to do this I thought of something simple like this but eventually the google confused me and spent a day looking at the alternatives and when I found this one I knew this was the one for me.

Keep it simple, thanks a lot mate.

Unknown said...

This worked perfectly. An elegant solution.

T said...

Ronald, Is this change Microsoft supported? If so, is there a way to add a picklist to the associated view to dynamically filter the view (like in the opportunity Associated View)?

kcompter said...

I've been wrestling with this for some time. Followed your instructions, but still cannot see the inactive records in associated view. Any ideas on what I could be missing?

CrmDev said...

hi kcompter

is it possible you marked the wrong view?
notice that the localizeName of the view is at the bottom of the 'savedquery' element, and the filter element is above that.

Alex said...

Thx a lot for the article, helped to solve issue with pluginDeveloper tool from Crm 4 SDK.