web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Get the child account with address field under hierarchy of parent

(0) ShareShare
ReportReport
Posted on by 958

How i get the child account information with its address fields under the parent account using Fetch XML.

*This post is locked for comments

I have the same question (0)
  • David Jennaway Profile Picture
    14,065 on at

    You just need to include an <attribute> element for each field you want within the <entity> or <link-entity> element. Note that, if a parent account has multiple child accounts, then you will get one record per child account. Depending on how you process the results, it may be easier to have the child account as the root <entity> element in the fetchXml, and the parent account joined as a <link-entity>

  • IbrahimOweidat Profile Picture
    45 on at

    you can use XrmServiceToolKit Javascript library to fetch your data. check that url community.dynamics.com/.../how-to-use-xrmservicetoolkit-javascript-library

  • Shakti Singh Rajput Profile Picture
    958 on at

    Can u show me that how it works or how i do this?

  • Verified answer
    Manju Augustine Profile Picture
    140 on at

    Hi Shakti,

    Please try this.

    <fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='false'>
    <entity name='account'>
    <attribute name='name' />
    <attribute name='accountid' />
    <attribute name='address1_postofficebox' />
    <attribute name='address1_name' />
    <attribute name='address1_longitude' />
    <attribute name='address1_latitude' />
    <attribute name='address1_fax' />
    <attribute name='address1_country' />
    <attribute name='address1_city' />
    <order attribute='name' descending='false' />
    <filter type='and'>
    <condition attribute='parentaccountid' operator='eq' value='{Parent Account ID}' />
    </filter>
    </entity>
    </fetch>


    Thanks,

    Manju

    If found useful, please mark the answer as verified.

  • Shakti Singh Rajput Profile Picture
    958 on at

    Given code is showing an error: -

    An exception System.FormatException was thrown while trying to convert input value '{Parent Account ID}' to attribute 'account.parentaccountid'. Expected type of attribute value: System.Guid. Exception raised: Expected hex 0x in '{0}'.

    This error is displayed in xml compiler, so now what should i do?

  • Shakti Singh Rajput Profile Picture
    958 on at

    Sorry,

    This code is working.

    Thanks Manju, it helps me alot.

  • Manju Augustine Profile Picture
    140 on at

    Glad to hear that you were able to solve the issue.

    Thanks,

    Manju

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the April Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans