Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

Get the child account with address field under hierarchy of parent

Posted on by 932

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

*This post is locked for comments

  • Manju Augustine Profile Picture
    Manju Augustine 140 on at
    RE: Get the child account with address field under hierarchy of parent

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

    Thanks,

    Manju

  • RE: Get the child account with address field under hierarchy of parent

    Sorry,

    This code is working.

    Thanks Manju, it helps me alot.

  • RE: Get the child account with address field under hierarchy of parent

    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?

  • Verified answer
    Manju Augustine Profile Picture
    Manju Augustine 140 on at
    RE: Get the child account with address field under hierarchy of parent

    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.

  • RE: Get the child account with address field under hierarchy of parent

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

  • IbrahimOweidat Profile Picture
    IbrahimOweidat 45 on at
    RE: Get the child account with address field under hierarchy of parent

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

  • David Jennaway Profile Picture
    David Jennaway 14,063 on at
    RE: Get the child account with address field under hierarchy of parent

    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>

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans