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:
http://crm.georged.id.au/post/2008/03/07/Displaying-inactive-records-in-associated-view.aspx.

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="4.0.0.0" languagecode="1043" generatedBy="OnPremise">
<Entities>
<Entity>
<Name .... />
....
<SavedQueries>
<savedquery>
<columnsetxml>
<columnset version="3.0">
<column>fullname</column>
<column>createdon</column>
<column>statuscode</column>
<column>subject</column>
<column>leadid</column>
<ascend>createdon</ascend>
<!-- Delete from here -->
<filter type="and">
<condition column="statecode" value="0" operator="eq" />
</filter>
<!-- Delete till here -->
</columnset>
</columnsetxml>
....
</savedquery>
</SavedQueries>
....
</Entity>
</Entities>
....
</ImportExportXml>

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.

8 comments:

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.

Beautiful

Joonas Juntunen 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.
-j-

Todd 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)?
T

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?
kcompter

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.