Retrieve Cases associated with Contacts and Accounts in one go

I was working on some work and got a requirement to get Cases of linked with Account and Contact. 

In a normal scenario, we can always do two Calls like 


Cases where CustomerID = Account GUID and Cases where CustomerID = Contact GUID


Somehow, I didn't like this approach of making two calls. Spending sometime helped to reduce a call and I was able to retrieve Cases related to Account and Contact in one call.


Here is the FetchXML I have used and uitype plays a major role here.
           


 
<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
                                      <entity name='incident'>
                                        <attribute name='title' />
                                        <attribute name='ticketnumber' />
                                        <attribute name='createdon' />
                                        <attribute name='incidentid' />
                                        <attribute name='caseorigincode' />
                                        <order attribute='title' descending='false' />
                                        <filter type='and'>
                                          <condition attribute='customerid' operator='in'>
                                            <value uitype='account'>{ACCOUNT-GUID}</value>
                                            <value uitype='contact'>{Contact-GUID}</value>
                                          </condition>
                                        </filter>
                                     </entity>
                                    </fetch>

Comments

  1. Mars Home Stay We have 4 No. of Rooms with Fully Air Conditioned and well furnished. And 2 Party Halls with 100 people gathering. Our professional staff is trained to take great care of you and your family's comfort. Location of Our Hotel is Nearby Taj Mahal is around 1.5 km. After all you deserve a break, and it needs to be a good one. The city rose to prominence as the capital of the Mughal Empire in the 16th Century. Many of the city's acclaimed heritage sites date back to this era, including the resplendent Taj Mahal.
    Homestay in Agra | Home Stay Near Taj Mahal | Best Homestay in Agra
    Mars Home Stay Near Taj Mahal | Homestay In Agra Near Taj Mahal
    Mars Homestay | Best Room In Agra | Mars Homestay In Agra
    Mars Home Stay
    E-mail: marshomestayagra@gmail.com
    +91-9897266123, 9568133330

    ReplyDelete

Post a Comment

Popular posts from this blog

Workflow Activity Input and Output Parameters and Data Types in MS CRM 2013/15/16

Get Workflow Guid in Javascript using OData query

Convert Plugin to Sandbox mode,