how to use fetchXML RRS feed

  • Question

  • Hi all, I am very unfamiliar with fetchXML and how to even use it. Would someone please be able to guide me in right direction or share some tutorials?

    I have the below code but have no idea where to even start, does it on go somewhere within the form?

    I am basically trying to make sure my account strategy shows up on my CHILD account if it is added on PARENT account.

    Do I add it on my account entity? If so, where do I have to add it..

    var fetchXml ="<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>" +
       "  <entity name='strategy'>" +
       "    <attribute name='child' />" +
       "    <attribute name='parent' />" +

        "    <attribute name='strategyid' />" +
       "    <attribute name='accountid' />" +
       "    <filter type='and'>" +
       "      <condition attribute='accountid' operator='eq' uitype='strategy' value='" + accId +"' />" +
       "    </filter>" +
       "    <link-entity name='account' from='accountid' to='accountid' visible='false' link-type='outer' alias='a'>" +
       "      <attribute name='child' />" +

       "      <attribute name='parent' />" +
       "    </link-entity>" +
       "  </entity>" +

    Friday, December 13, 2013 2:56 PM

All replies

  • In terms of "where" to add the fetch. You would maybe have a method that would be in charge of getting account strategy if the account that trigged the account plugin is a Child (has or not has a parent account) and then copy paste that fetch where accId would be the Id of the Parent Account set in the Child. Important to remember that a fetch has to be followed by a retrieve and conditions to verify that the retrieve actually brought something. Then have the method return the record of the strategy and use it however you would. 

    Don't know if what I answered is what you meant by "where", but that should help you start the google searches. :D

    Friday, December 13, 2013 4:52 PM
  • we use FetchXML to construct a query and get something from CRM,

    To execute a FetchXML query in Microsoft Dynamics CRM 2011, you must first build the XML query string. After you create the query string, use the IOrganizationService.RetrieveMultiple method to execute the query string. The privileges of the logged on user affects the set of records returned. Only records for which the logged on user has read access will be returned.

    Friday, December 13, 2013 5:42 PM