locked
Editing FetchXML code in Microsoft Dynamics CRM 2011 RRS feed

  • Question

  • HI,

    I would like to ask if there is a possible way to edit the fetchXML code in MS Dynamics CRM 2011? Like updating it, adding or deleting codes inside of it. Thank you.

    Friday, January 17, 2014 3:06 AM

Answers

  • Thank you for sharing your ideas in here. 
    • Marked as answer by LirpaEcarg Monday, February 3, 2014 2:52 AM
    Monday, February 3, 2014 2:52 AM

All replies

  • using the fetch xml code you can retrieve the records guid 

    By using the guid of the record you can perform updating and etc operations, search in google you get many sample regarding it.


    ms crm

    Friday, January 17, 2014 6:01 AM
  • Hi,


    FetchXML is a proprietary query language that is used in Microsoft Dynamics CRM 2011. It is based on a schema that describes the capabilities of the language. The FetchXML language supports similar query capabilities as query expressions. In addition it is used as a serialized form of query, used to save a query as a user-owned saved view in the userquery entity and as an organization-owned saved view in the savedquery entity. A FetchXML query can be executed by using the IOrganizationService.RetrieveMultiple method. You can convert a FetchXML query to a query expression with the FetchXmlToQueryExpressionRequest message.

    Microsoft Dynamics CRM 2011 Update Rollup 12 and the Microsoft Dynamics CRM December 2012 Service Update contains performance optimizations for Quick Find queries. In FetchXML, these are specified by the isquickfindfields attribute on a filter. For more information, see Build Queries with QueryExpression and About the IsQuickFindFilter Property.

    For information about how to use LINQPad to work with FetchXML, see this blog post: Getting FetchXML from LINQPad.


    In the following example, the FetchXML statement retrieves all accounts where the last name of the owning user is not equal to Cannon:


    <fetchmapping='logical'><entityname='account'><attributename='accountid'/><attributename='name'/><link-entityname='systemuser'to='owninguser'><filtertype='and'><conditionattribute='lastname'operator='ne'value='Cannon'/></filter></link-entity></entity></fetch>

    The following code shows how to execute a FetchXML query:

    // Retrieve all accounts owned by the user with read access rights to the accounts and // where the last name of the user is not Cannon. string fetch2 = @" <fetch mapping='logical'> <entity name='account'> <attribute name='accountid'/> <attribute name='name'/> <link-entity name='systemuser' to='owninguser'> <filter type='and'> <condition attribute='lastname' operator='ne' value='Cannon' /> </filter> </link-entity> </entity> </fetch> "; EntityCollection result = _serviceProxy.RetrieveMultiple(new FetchExpression(fetch2)); now you "result" contains the retrieved records.

    other than this you cant do anything.

    Hope this may help you



    Warm Regards, Suresh Kumar D

    Friday, January 17, 2014 6:20 AM
  • Thank You. 
    Monday, February 3, 2014 2:50 AM
  • Thank you for sharing your ideas in here. 
    • Marked as answer by LirpaEcarg Monday, February 3, 2014 2:52 AM
    Monday, February 3, 2014 2:52 AM