Tag Archives: Crm 2011

Microsoft Dynamics CRM 2013 – Plugin Messages – RetrieveMultiple– deep dive

Message Name Ownership Type Message Availability Entity Supported Deployment
RetrieveMultiple User-owned and organization-owned entities Both Server

The RetrieveMultiple Message is called when you open a view, and query entities with fetchxml or QueryExpression.

What happens when you retrieve a list of entities (in this case it is a list of open opportunities)  …

12.10.2013 19:53:42.004 :: INFO :: Entity: opportunity => Message: RetrieveMultiple => Stage: 10
12.10.2013 19:53:42.009 :: INFO :: Entity: opportunity => Message: RetrieveMultiple => Stage: 20
12.10.2013 19:53:42.014 :: INFO :: Entity: opportunity => Message: RetrieveMultiple => Stage: 40

The message has an input Parameters called “Query”. This is a fetchXml expression. In the example below I pressed on the button reload in the view “open opportunities”. As you an see the PrimaryEntityName is set to opportunity. On Stage 10 and 20 you still have the chance to change the fetchxml, but on stage 40 (post stage) you will find an outputparameter of tye BusinessEntityCollection which is a list of the returned entities (in our case the opportunities).

If you take a closer look at the inputParameter “Query” you will perhaps recognize that the fetchxml represents the FetchXml of the SavedQueryBase table in the sql database. There are only a few differences.

These three attributes are added for the view. The first parameter (page)  is the paging cookie, the count parameter is the number of records the view wants to retrieve and the returntotalrecordcount tells the query to return the total number of  records. If you go to the next page in the view the page variable is increased and so on …

page=”1″
count=”250″
returntotalrecordcount=”true”

Here is the corresponding context-log.

12.10.2013 19:53:41.931 :: INFO :: Start XrmLoggerPlugin ======================================================================== >>>
12.10.2013 19:53:41.931 :: INFO :: MessageName: RetrieveMultiple
12.10.2013 19:53:41.931 :: INFO :: PrimaryEntityName: opportunity
12.10.2013 19:53:41.931 :: INFO :: PrimaryEntityId: 00000000-0000-0000-0000-000000000000
12.10.2013 19:53:41.931 :: INFO :: Stage: 10
12.10.2013 19:53:41.931 :: INFO :: BusinessUnitId: 7647d68b-471d-e311-b013-000c2926dde4
12.10.2013 19:53:41.931 :: INFO :: CorrelationId: 55308b0f-0896-45a8-b653-605bb499f6eb
12.10.2013 19:53:41.931 :: INFO :: Depth: 1
12.10.2013 19:53:41.931 :: INFO :: InitiatingUserId: 0cd683a0-541d-e311-b013-000c2926dde4
12.10.2013 19:53:41.931 :: INFO :: InputParameters:
12.10.2013 19:53:42.004 :: INFO ::  >  Key: Query / Value: Microsoft.Xrm.Sdk.Query.QueryExpression  >> Queryexpression:
<fetch distinct="false" no-lock="true" mapping="logical" page="1" count="250" returntotalrecordcount="true"><entity name="opportunity"><attribute name="name" /><attribute name="estimatedvalue" /><attribute name="estimatedclosedate" /><attribute name="customerid" /><attribute name="opportunityratingcode" /><attribute name="closeprobability" /><attribute name="opportunityid" /><attribute name="name" /><attribute name="customerid" /><attribute name="estimatedclosedate" /><attribute name="estimatedvalue" /><attribute name="closeprobability" /><attribute name="opportunityratingcode" /><filter type="and"><condition attribute="statecode" operator="eq" value="0" /></filter><order attribute="estimatedclosedate" descending="false" /><link-entity name="contact" to="customerid" from="contactid" link-type="outer" alias="opportunitycustomeridcontactcontactid"><attribute name="emailaddress1" /></link-entity></entity></fetch>
12.10.2013 19:53:42.004 :: INFO :: IsExecutingOffline: False
12.10.2013 19:53:42.004 :: INFO :: IsInTransaction: False
12.10.2013 19:53:42.004 :: INFO :: IsOfflinePlayback: False
12.10.2013 19:53:42.004 :: INFO :: IsolationMode: 1
12.10.2013 19:53:42.004 :: INFO :: Mode: 0
12.10.2013 19:53:42.004 :: INFO :: OperationCreatedOn: 10/12/2013 5:53:41 PM
12.10.2013 19:53:42.004 :: INFO :: OperationId: 00000000-0000-0000-0000-000000000000
12.10.2013 19:53:42.004 :: INFO :: OrganizationId: eba3ca00-3338-49dd-b206-8ed1aacb1c3e
12.10.2013 19:53:42.004 :: INFO :: OrganizationName: crmdemo
12.10.2013 19:53:42.004 :: INFO :: OutputParameters:
12.10.2013 19:53:42.004 :: INFO :: 
12.10.2013 19:53:42.004 :: INFO :: OwningExtension: Microsoft.Xrm.Sdk.EntityReference
12.10.2013 19:53:42.004 :: INFO :: ParentContext: 
12.10.2013 19:53:42.004 :: INFO :: PostEntityImages: Microsoft.Xrm.Sdk.EntityImageCollection
12.10.2013 19:53:42.004 :: INFO :: PreEntityImages: Microsoft.Xrm.Sdk.EntityImageCollection
12.10.2013 19:53:42.004 :: INFO :: RequestId: 
12.10.2013 19:53:42.004 :: INFO :: SecondaryEntityName: none
12.10.2013 19:53:42.004 :: INFO :: SharedVariables: Microsoft.Xrm.Sdk.ParameterCollection
12.10.2013 19:53:42.004 :: INFO :: UserId: 0cd683a0-541d-e311-b013-000c2926dde4
12.10.2013 19:53:42.004 :: INFO :: Ende XrmLoggerPlugin ======================================================================== >>>

12.10.2013 19:53:42.006 :: INFO :: Start XrmLoggerPlugin ======================================================================== >>>
12.10.2013 19:53:42.006 :: INFO :: MessageName: RetrieveMultiple
12.10.2013 19:53:42.006 :: INFO :: PrimaryEntityName: opportunity
12.10.2013 19:53:42.006 :: INFO :: PrimaryEntityId: 00000000-0000-0000-0000-000000000000
12.10.2013 19:53:42.006 :: INFO :: Stage: 20
12.10.2013 19:53:42.006 :: INFO :: BusinessUnitId: 7647d68b-471d-e311-b013-000c2926dde4
12.10.2013 19:53:42.006 :: INFO :: CorrelationId: 55308b0f-0896-45a8-b653-605bb499f6eb
12.10.2013 19:53:42.006 :: INFO :: Depth: 1
12.10.2013 19:53:42.006 :: INFO :: InitiatingUserId: 0cd683a0-541d-e311-b013-000c2926dde4
12.10.2013 19:53:42.006 :: INFO :: InputParameters:
12.10.2013 19:53:42.006 :: INFO ::  >  Key: Query / Value: Microsoft.Xrm.Sdk.Query.QueryExpression  >> Queryexpression:
<fetch distinct="false" no-lock="true" mapping="logical" page="1" count="250" returntotalrecordcount="true"><entity name="opportunity"><attribute name="name" /><attribute name="estimatedvalue" /><attribute name="estimatedclosedate" /><attribute name="customerid" /><attribute name="opportunityratingcode" /><attribute name="closeprobability" /><attribute name="opportunityid" /><attribute name="name" /><attribute name="customerid" /><attribute name="estimatedclosedate" /><attribute name="estimatedvalue" /><attribute name="closeprobability" /><attribute name="opportunityratingcode" /><filter type="and"><condition attribute="statecode" operator="eq" value="0" /></filter><order attribute="estimatedclosedate" descending="false" /><link-entity name="contact" to="customerid" from="contactid" link-type="outer" alias="opportunitycustomeridcontactcontactid"><attribute name="emailaddress1" /></link-entity></entity></fetch>
12.10.2013 19:53:42.006 :: INFO :: IsExecutingOffline: False
12.10.2013 19:53:42.006 :: INFO :: IsInTransaction: False
12.10.2013 19:53:42.006 :: INFO :: IsOfflinePlayback: False
12.10.2013 19:53:42.006 :: INFO :: IsolationMode: 1
12.10.2013 19:53:42.006 :: INFO :: Mode: 0
12.10.2013 19:53:42.006 :: INFO :: OperationCreatedOn: 10/12/2013 5:53:42 PM
12.10.2013 19:53:42.006 :: INFO :: OperationId: 00000000-0000-0000-0000-000000000000
12.10.2013 19:53:42.006 :: INFO :: OrganizationId: eba3ca00-3338-49dd-b206-8ed1aacb1c3e
12.10.2013 19:53:42.006 :: INFO :: OrganizationName: crmdemo
12.10.2013 19:53:42.006 :: INFO :: OutputParameters:
12.10.2013 19:53:42.006 :: INFO :: 
12.10.2013 19:53:42.006 :: INFO :: OwningExtension: Microsoft.Xrm.Sdk.EntityReference
12.10.2013 19:53:42.006 :: INFO :: ParentContext: 
12.10.2013 19:53:42.006 :: INFO :: PostEntityImages: Microsoft.Xrm.Sdk.EntityImageCollection
12.10.2013 19:53:42.006 :: INFO :: PreEntityImages: Microsoft.Xrm.Sdk.EntityImageCollection
12.10.2013 19:53:42.006 :: INFO :: RequestId: 
12.10.2013 19:53:42.006 :: INFO :: SecondaryEntityName: none
12.10.2013 19:53:42.006 :: INFO :: SharedVariables: Microsoft.Xrm.Sdk.ParameterCollection
12.10.2013 19:53:42.006 :: INFO :: UserId: 0cd683a0-541d-e311-b013-000c2926dde4
12.10.2013 19:53:42.006 :: INFO :: Ende XrmLoggerPlugin ======================================================================== >>>

12.10.2013 19:53:42.011 :: INFO :: Start XrmLoggerPlugin ======================================================================== >>>
12.10.2013 19:53:42.011 :: INFO :: MessageName: RetrieveMultiple
12.10.2013 19:53:42.011 :: INFO :: PrimaryEntityName: opportunity
12.10.2013 19:53:42.011 :: INFO :: PrimaryEntityId: 00000000-0000-0000-0000-000000000000
12.10.2013 19:53:42.011 :: INFO :: Stage: 40
12.10.2013 19:53:42.011 :: INFO :: BusinessUnitId: 7647d68b-471d-e311-b013-000c2926dde4
12.10.2013 19:53:42.011 :: INFO :: CorrelationId: 55308b0f-0896-45a8-b653-605bb499f6eb
12.10.2013 19:53:42.011 :: INFO :: Depth: 1
12.10.2013 19:53:42.011 :: INFO :: InitiatingUserId: 0cd683a0-541d-e311-b013-000c2926dde4
12.10.2013 19:53:42.011 :: INFO :: InputParameters:
12.10.2013 19:53:42.014 :: INFO ::  >  Key: Query / Value: Microsoft.Xrm.Sdk.Query.QueryExpression  >> Queryexpression:
<fetch distinct="false" no-lock="true" mapping="logical" page="1" count="250" returntotalrecordcount="true"><entity name="opportunity"><attribute name="name" /><attribute name="estimatedvalue" /><attribute name="estimatedclosedate" /><attribute name="customerid" /><attribute name="opportunityratingcode" /><attribute name="closeprobability" /><attribute name="opportunityid" /><attribute name="name" /><attribute name="customerid" /><attribute name="estimatedclosedate" /><attribute name="estimatedvalue" /><attribute name="closeprobability" /><attribute name="opportunityratingcode" /><filter type="and"><condition attribute="statecode" operator="eq" value="0" /></filter><order attribute="estimatedclosedate" descending="false" /><link-entity name="contact" to="customerid" from="contactid" link-type="outer" alias="opportunitycustomeridcontactcontactid"><attribute name="emailaddress1" /></link-entity></entity></fetch>
12.10.2013 19:53:42.014 :: INFO :: IsExecutingOffline: False
12.10.2013 19:53:42.014 :: INFO :: IsInTransaction: False
12.10.2013 19:53:42.014 :: INFO :: IsOfflinePlayback: False
12.10.2013 19:53:42.014 :: INFO :: IsolationMode: 1
12.10.2013 19:53:42.014 :: INFO :: Mode: 0
12.10.2013 19:53:42.014 :: INFO :: OperationCreatedOn: 10/12/2013 5:53:42 PM
12.10.2013 19:53:42.014 :: INFO :: OperationId: 00000000-0000-0000-0000-000000000000
12.10.2013 19:53:42.014 :: INFO :: OrganizationId: eba3ca00-3338-49dd-b206-8ed1aacb1c3e
12.10.2013 19:53:42.014 :: INFO :: OrganizationName: crmdemo
12.10.2013 19:53:42.014 :: INFO :: OutputParameters:
12.10.2013 19:53:42.014 :: INFO ::  >  Key: BusinessEntityCollection / Value: Microsoft.Xrm.Sdk.EntityCollection  >> EntityCollection:
opportunity/ (8/8)
12.10.2013 19:53:42.014 :: INFO :: OwningExtension: Microsoft.Xrm.Sdk.EntityReference
12.10.2013 19:53:42.014 :: INFO :: ParentContext: 
12.10.2013 19:53:42.014 :: INFO :: PostEntityImages: Microsoft.Xrm.Sdk.EntityImageCollection
12.10.2013 19:53:42.014 :: INFO :: PreEntityImages: Microsoft.Xrm.Sdk.EntityImageCollection
12.10.2013 19:53:42.014 :: INFO :: RequestId: 
12.10.2013 19:53:42.014 :: INFO :: SecondaryEntityName: none
12.10.2013 19:53:42.014 :: INFO :: SharedVariables: Microsoft.Xrm.Sdk.ParameterCollection
12.10.2013 19:53:42.014 :: INFO :: UserId: 0cd683a0-541d-e311-b013-000c2926dde4
12.10.2013 19:53:42.014 :: INFO :: Ende XrmLoggerPlugin ======================================================================== >>>

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Microsoft Dynamics CRM 2011 – Problem with setFocus and Lookup Fields

I tried to set the focus on the “from”-Field in the onload event of a phone call activity. Unfortunatley the focus jumps alway to “subject”. This might be a bug, and the only wokaround I found so far is to set a little delay. This is no a very nice solution but better than nothing.

btw: this bug is gone in crm 2013!

 

function onLoadForm() {
   window.setTimeout(focusFrom,100)
}

function focusFrom() {
  var _Control = Xrm.Page.ui.controls.get("from");
  _Control.setFocus();
}

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>