Thursday, December 26, 2013

Retrieve un-published data in Dynamics CRM - 'RetrieveMultipleRequest' and 'RetrieveUnpublishedMultipleRequest’

We all know would have used 'RetrieveMultipleRequest' to obtained needed data from CRM system. RetrieveMultipleRequest retrieves a collection of published data in CRM, but unfortunately we where in need to data in its unpublished state too. That's when we came across 'RetrieveUnpublishedMultipleRequest’ message.

In this post we will have a look at how to use 'RetrieveUnpublishedMultipleRequest’ and how it works.

RetrieveMultiple : Contains the data that is needed to retrieve a collection of records that satisfy the specified query criteria.

RetrieveUnpublishedMultiple : Contains the data that is needed to retrieve a collection of unpublished organization-owned records that satisfy the specified query criteria. Below are the list of default organization-owned entities that supports RetrieveUnpublishedMultiple message.

  • SavedQuery
  • SavedQueryVisualization
  • SiteMap
  • SystemForm
  • WebResource

We will create a QueryExpression to retrieve web resource named ‘new_unpublishedsample’ which is in saved and un-published state and try to execute the same query using both ‘RetrieveMultipleRequest’ and ‘RetrieveUnpublishedMultipleRequest’ to see the difference between 2 request's.






As you can see in the above screenshot, content value differs in both the response. 'RetrieveUnpublished MultipleRequest' provides the most recent unpublished data, where as 'Retrieve MultipleRequest' provides the last published content of the web resource.


Points to Remember:

These records (SavedQuery, SavedQueryVisualization, SiteMap, SystemForm, WebResource) are automatically published when they are created or deleted. As soon as the records are published, both the message's return the same data.

1 comment:

  1. Informative blog and it was up to the point describing the information very effectively. Thanks to blog author for wonderful and informative post...
    Microsoft Azure Online Training

    ReplyDelete