FetchXML from a grandparent RRS feed

  • Question

  • Hi all,

    I am looking for an example fetch xml jscript that will pull data from a grandparent of the entity I am working with.
    To explain further, I have an entity (lets call it aaa_child) that is created from within the context of entity aaa_parent. aaa_parent is a child of entity aaa_grandparent (which in my case is a contact or account record). When I create a aaa_child record, I need several address fields to auto-populate from the aaa_grandparent entity.

    I need to use fetchxml and not use the UI to map from grandparent, to parent, to child because there is a requiement to 'refresh' these attributes onload of the form as they could change fairly often on the grandparent.

    Any examples would be greatly appreciated.



    Saturday, February 20, 2010 10:29 AM


All replies

  • Hi, Rob.

    To build FetchXml request you can use this tool .
    Sample where Fetch is used you can check here .

    Truth is opened the prepared mind

    My blog (english)
    Мой блог (русскоязычный)free countersLocations of visitors to this page
    • Proposed as answer by Mayank Pujara Saturday, February 20, 2010 10:53 PM
    • Marked as answer by Rob Boyers Wednesday, February 24, 2010 9:05 AM
    Saturday, February 20, 2010 10:46 AM
  • Hi Rob,

    The following query retrieves all contacts that belong to an account ... that in turn belongs to another account.

    <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="true">
    <entity name="contact">
    <attribute name="fullname"/>
    <attribute name="telephone1"/>
    <attribute name="contactid"/>
    <order attribute="fullname" descending="false"/>
    <link-entity name="account" from="primarycontactid" to="contactid" alias="aa">
    <filter type="and">
    <condition attribute="parentaccountid" operator="eq" uiname="Contoso" uitype="account" value="{D9A0170F-CD93-DD11-9729-0010DCFC164D}"/></filter>

    For your specific query, try perform the search in adv find. If you get the correct result, press F11 to access the URL of the ADV find box, then replace with the following : javascript:prompt("my query:", resultRender.FetchXml.value);

    This should retrieve the fetchxml you're looking for.


    Karlo Swart Ver206
    Sunday, February 21, 2010 12:18 PM
  • Thanks guys, very helpful.

    Wednesday, February 24, 2010 9:05 AM