locked
CRM 2011 - Error in advance search on PhoneCall entity RRS feed

  • Question

  • Hi All,

    I am facing problem in Advance Search of PhoneCall Entity on my test environment (but the same is on the production environment). I am not using English version, so instead of screenshots I'll describe everything.

    Trying to find all PhoneCalls with defined not-null ToRecipent.

    Download FetchXML:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
      <entity name="phonecall">
        <attribute name="subject" />
        <attribute name="statecode" />
        <attribute name="prioritycode" />
        <attribute name="scheduledend" />
        <attribute name="regardingobjectid" />
        <attribute name="rlpl_status" />
        <attribute name="directioncode" />
        <attribute name="phonenumber" />
        <attribute name="ownerid" />
        <attribute name="to" />
        <order attribute="subject" descending="false" />
        <link-entity name="activityparty" from="activityid" to="activityid" alias="aa">
          <filter type="and">
            <condition attribute="participationtypemask" operator="eq" value="2" />
            <condition attribute="partyid" operator="not-null" />
          </filter>
        </link-entity>
      </entity>
    </fetch>

    Instead of results I can see standard Unexpected Error on site. I have run the CRM 2011 Diagnostic tool to get a read out of what is happening there and found this exception after select statement:

    Microsoft.Crm.Extensibility.InternalOperationPlugin, Microsoft.Crm.ObjectModel, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35; ClassName: Microsoft.Crm.Extensibility.InternalOperationPlugin; Exception: Unhandled Exception: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
       at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
       at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
       at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
       at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IServiceProvider serviceProvider)
       at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
       at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
    Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object.
       at Microsoft.Crm.ObjectModel.CommunicationActivityServiceBase.RetrieveMultiple(EntityExpression entityExpression, ExecutionContext context)

    I executed the same query on database and it returned results successfully. It looks like CRM has problem with loading and converting this information.
    I found the same bug in Advance Search of Phonecall Entity with 2 others custom link-entities, but the rest looks fine.


    What is more...
    I deleted ToRecipent column from Advance Search and the results showed up, but I can't open any of them no matter how many times I click on them.

    Download FetchXML:

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
      <entity name="phonecall">
        <attribute name="subject" />
        <attribute name="statecode" />
        <attribute name="prioritycode" />
        <attribute name="scheduledend" />
        <attribute name="regardingobjectid" />
        <attribute name="rlpl_status" />
        <attribute name="directioncode" />
        <attribute name="phonenumber" />
        <attribute name="ownerid" />
        <order attribute="subject" descending="false" />
        <link-entity name="activityparty" from="activityid" to="activityid" alias="ab">
          <filter type="and">
            <condition attribute="participationtypemask" operator="eq" value="2" />
            <condition attribute="partyid" operator="not-null" />
          </filter>
        </link-entity>
      </entity>
    </fetch>

    I even deleted all Phonecalls except one to make sure it isn't related with corrupted test data. Still Exception appeared. What's wrong?


    • Edited by Domin0 Tuesday, July 1, 2014 11:58 AM
    Tuesday, July 1, 2014 11:57 AM

Answers

  • It is Microsoft, so as usual the problem was solved thanks to the only one good solution for everything: "Turn off --> turn on".

    The Advance Search of PhoneCall Entity depends on an Advance Search View.

    I have no idea why but this view in the database was broken.

    There is a simple solution for any problem like this. Add any column to view, save, publish, remove this column, save, publish. We made no change, but we forced server to rebiuld view in the database.

    Everything is just fine now.

    Cheers

    • Marked as answer by Domin0 Thursday, October 23, 2014 9:49 AM
    Thursday, October 23, 2014 9:49 AM