Corrupted Quick Find Views in MS CRM 2011

The Error

I had a MS CRM 2011 solution with a corrupted Quick Find View
The cause of all this is yet unknown… it’s probably something like SolutionPackager XML copy-and-pasting-stuff.
Not a very nice thing.

The View is showing errors…
… the view can be modified… but not saved… causing this error.

“The dependent component [missing Component Type] (Id=[missing Component Id]) does not exist. Failure trying to associate it with [dependent Component Type](Id=[dependent Component Id]) as a dependency. Missing dependency lookup type = PrimaryKeyLookup”

One way of fixing this is via – totally unsupported – database updates.

The Solution

Step #1    Get ObjectTypeCode

select ObjectTypeCode
from MetadataSchema.Entity
where PhysicalName=‘new_abonnement’

This appears to be 10022.

select *
from MetadataSchema.Entity
where ObjectTypeCode = 10022

Stap #2    Get Quick Find View

select *
from SavedQuery
where ReturnedTypeCode = 10022 and QueryType = 4

QueryType 4 is the Quick Find View. Check this for an overview of all QueryTypes.

Stap #3    Check FetchXml

select FetchXml
from SavedQuery
where ReturnedTypeCode = 10022 and QueryType = 4

The result is all wrong… mine looked like this… wrong entity … wrong attributes… all wrong, wrong, wrong


<fetch version="1.0" mapping="logical">

    <entity name="hig_donatie">

        <attribute name="hig_name" />

        <attribute name="createdon" />

        <order attribute="hig_name" descending="false" />

        <filter type="and">

            <condition attribute="statecode" operator="eq" value="0" />


        <filter type="or" isquickfindfields="1">

            <condition attribute="importsequencenumber" operator="eq" value="{1}" />

            <condition attribute="transactioncurrencyid" operator="like" value="{0}" />

            <condition attribute="hig_termijnbedrag_base" operator="eq" value="{2}" />

            <condition attribute="hig_termijnbedrag" operator="eq" value="{2}" />

            <condition attribute="hig_statusincassomachtiging" operator="like" value="{0}"/>

            <condition attribute="statecode" operator="like" value="{0}" />

            <condition attribute="hig_soortdonatie" operator="like" value="{0}" />

            <condition attribute="statuscode" operator="like" value="{0}" />

            <condition attribute="overriddencreatedon" operator="on" value="{3}" />

            <condition attribute="hig_opzegreden" operator="like" value="{0}" />

            <condition attribute="hig_opzegdatum" operator="on" value="{3}" />

            <condition attribute="hig_meerderetermijnen" operator="like" value="{0}" />

            <condition attribute="modifiedon" operator="on" value="{3}" />

            <condition attribute="modifiedonbehalfby" operator="like" value="{0}" />

            <condition attribute="modifiedby" operator="like" value="{0}" />

            <condition attribute="createdon" operator="on" value="{3}" />

            <condition attribute="createdonbehalfby" operator="like" value="{0}" />

            <condition attribute="createdby" operator="like" value="{0}" />

            <condition attribute="hig_donatiesid" operator="like" value="{0}" />

            <condition attribute="hig_name" operator="like" value="{0}" />

            <condition attribute="hig_donantiebestemming" operator="like" value="{0}" />

            <condition attribute="hig_datummachtigingontvangen" operator="on" value="{3}"/>

            <condition attribute="hig_contactpersoonid" operator="like" value="{0}" />

            <condition attribute="hig_betaalwijze" operator="like" value="{0}" />

            <condition attribute="hig_betaalmaand" operator="like" value="{0}" />

            <condition attribute="hig_betaalfrequentie" operator="like" value="{0}" />

            <condition attribute="hig_bedrijfid" operator="like" value="{0}" />

            <condition attribute="hig_bedrageenmalig_base" operator="eq" value="{2}" />

            <condition attribute="hig_bedrageenmalig" operator="eq" value="{2}" />

            <condition attribute="hig_bedrag_base" operator="eq" value="{2}" />

            <condition attribute="hig_bedrag" operator="eq" value="{2}" />

            <condition attribute="hig_bankrekeningnummer" operator="like" value="{0}" />

            <condition attribute="hig_automatischeincassogewenst" operator="like" value="{0}" />

            <condition attribute="hig_actie" operator="like" value="{0}" />

            <condition attribute="hig_aantaltermijnen" operator="eq" value="{1}" />


        <attribute name="exchangerate" />

        <attribute name="transactioncurrencyid" />

        <attribute name="hig_termijnbedrag_base" />

        <attribute name="hig_termijnbedrag" />

        <attribute name="hig_statusincassomachtiging" />

        <attribute name="statecode" />

        <attribute name="hig_soortdonatie" />

        <attribute name="statuscode" />

        <attribute name="overriddencreatedon" />

        <attribute name="hig_opzegreden" />

        <attribute name="hig_opzegdatum" />

        <attribute name="hig_meerderetermijnen" />

        <attribute name="modifiedon" />

        <attribute name="modifiedonbehalfby" />

        <attribute name="modifiedby" />

        <attribute name="createdonbehalfby" />

        <attribute name="createdby" />

        <attribute name="hig_donatiesid" />

        <attribute name="hig_donantiebestemming" />

        <attribute name="hig_datummachtigingontvangen" />

        <attribute name="hig_contactpersoonid" />

        <attribute name="hig_betaalwijze" />

        <attribute name="hig_betaalmaand" />

        <attribute name="hig_betaalfrequentie" />

        <attribute name="hig_bedrijfid" />

        <attribute name="hig_bedrageenmalig_base" />

        <attribute name="hig_bedrageenmalig" />

        <attribute name="hig_bedrag_base" />

        <attribute name="hig_bedrag" />

        <attribute name="hig_bankrekeningnummer" />

        <attribute name="hig_automatischeincassogewenst" />

        <attribute name="hig_actie" />

        <attribute name="hig_aantaltermijnen" />

        <attribute name="hig_donatieid" />




Stap #4    Correct the FetchXml

update SavedQuery set FetchXml =
‘<fetch version=”1.0″ mapping=”logical”>

    <entity name=”new_abonnement”>

        <attribute name=”new_naam” />

        <filter type=”and”>

            <condition attribute=”statecode” operator=”eq” value=”0″ />


        <filter type=”or” isquickfindfields=”1″>

            <condition attribute=”new_naam” operator=”eq” value=”{1}” />




where ReturnedTypeCode = 10022 and QueryType = 4

Stap #5    Check the LayoutXml

select LayoutXml

from SavedQuery

where ReturnedTypeCode = 10022 and QueryType = 4

The result is all wrong… mine looked like this… correct entity … wrong attributes… all wrong, wrong, wrong

<grid name=“resultset” object=“10022” jump=“new_name” select=“1” icon=“1” preview=“1”>

    <row name=“result” id=“new_abonnementid”>

        <cell name=“new_name” width=“300” />

        <cell name=“createdon” width=“125” />

        <cell name=“new_aantaltermijnen” width=“100” />

        <cell name=“new_actie” width=“100” />

        <cell name=“new_automatischeincassogewenst” width=“100” />

        <cell name=“new_bankrekeningnummer” width=“100” />

        <cell name=“new_bedrag” width=“100” />

        <cell name=“new_bedrag_base” width=“100” />

        <cell name=“new_bedrageenmalig” width=“100” />

        <cell name=“new_bedrageenmalig_base” width=“100” />

        <cell name=“new_bedrijfid” width=“100” />

        <cell name=“new_betaalfrequentie” width=“100” />

        <cell name=“new_betaalmaand” width=“100” />

        <cell name=“new_betaalwijze” width=“100” />

        <cell name=“new_contactpersoonid” width=“100” />

        <cell name=“new_datummachtigingontvangen” width=“100” />

        <cell name=“new_donantiebestemming” width=“100” />

        <cell name=“new_donatiesid” width=“100” />

        <cell name=“createdby” width=“100” />

        <cell name=“createdonbehalfby” width=“100” />

        <cell name=“modifiedby” width=“100” />

        <cell name=“modifiedonbehalfby” width=“100” />

        <cell name=“modifiedon” width=“100” />

        <cell name=“new_meerderetermijnen” width=“100” />

        <cell name=“new_opzegdatum” width=“100” />

        <cell name=“new_opzegreden” width=“100” />

        <cell name=“overriddencreatedon” width=“100” />

        <cell name=“statuscode” width=“100” />

        <cell name=“new_soortdonatie” width=“100” />

        <cell name=“statecode” width=“100” />

        <cell name=“new_statusincassomachtiging” width=“100” />

        <cell name=“new_termijnbedrag” width=“100” />

        <cell name=“new_termijnbedrag_base” width=“100” />

        <cell name=“transactioncurrencyid” width=“100” />

        <cell name=“exchangerate” width=“100” />



Stap #5    Correct the LayoutXml

update SavedQuery set LayoutXml =
‘<grid name=”resultset” object=”10022″ jump=”new_naam” select=”1″ icon=”1″ preview=”1″>

    <row name=”result” id=”new_abonnementid”>

        <cell name=”new_naam” width=”300″ />



where ReturnedTypeCode = 10022 and QueryType = 4


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s