Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

CRM FetchXML Parent Company Name Attribute

(1) ShareShare
ReportReport
Posted on by

Hi all,

i simply try to get the Company Name from XML but it doesn't work for me. My FetchXML looks like this. What is the correct attribute to get the company name?

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
<entity name="contact">
<attribute name="contactid" />
<attribute name="ownerid" />
<attribute name="parentcustomerid" />
<attribute name="fullname" />
<attribute name="firstname" />
<attribute name="lastname" />
<attribute name="jobtitle" />
<attribute name="telephone1" />
<attribute name="telephone2" />
<attribute name="mobilephone" />
<attribute name="emailaddress1" />
<attribute name="fax" />
<attribute name="department" />
<attribute name="address1_line1" />
<attribute name="address1_line2" />
<attribute name="address1_line3" />
<attribute name="address1_city" />
<attribute name="address1_stateorprovince" />
<attribute name="address1_postalcode" />
<attribute name="address1_country" />
<order attribute="fullname" descending="false" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
</entity>
</fetch>

*This post is locked for comments

  • gdas Profile Picture
    50,091 Moderator on at
    RE: CRM FetchXML Parent Company Name Attribute

    This is not the right answers you verified.

  • gdas Profile Picture
    50,091 Moderator on at
    RE: CRM FetchXML Parent Company Name Attribute

    Please close the thread by verifying any of  above answer so that in future people can get help with this thread.

  • Verified answer
    Mick_4711 Profile Picture
    552 on at
    RE: CRM FetchXML Parent Company Name Attribute

    Hey Dario,

    You can download the XRMToolBox and start FetchXML Builder.

    With this tool you can check the FetchXML and its output(s).

    What do wanna do exactly?

  • Community Member Profile Picture
    on at
    RE: CRM FetchXML Parent Company Name Attribute

    hi goutam,

    thank you for your reply. that sounds like rocket science for me :-) i am not very familiar with programming. maybe i have to outsouce that task.

    kind regards

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at
    RE: CRM FetchXML Parent Company Name Attribute

    Hi ,

    As already suggested above  from "parentcustomerid" lookup normally for any contact  parent account or company name. As "parentcustomerid"  field is lookup you need  to retrieve name from once results will retrieve using name property.

    You can refer below references how to retrieve using C# .

    arunpotti.wordpress.com/.../retrieve-records-using-query-expression-c-sdk-in-crm

    arunpotti.wordpress.com/.../retrieve-records-using-fetchxml-c-sdk-in-crm

    If you are using JavaScript then you can write web api query instead of Fetch XML as well .

    syednizamsyed.blogspot.com/.../query-data-using-web-api.html

    Please share your code if you are still  facing issue.

  • Suggested answer
    Sreevalli Profile Picture
    3,256 on at
    RE: CRM FetchXML Parent Company Name Attribute

    Hi,

    "parentcustomerid" is right field for Company Name out of box field of Contact. which you already using.

    but since it is Customer field, if you are trying to find contact and the existing data is account or vise versa then it will return null value. please check and target for right entity based on data.

    also share us how you are using the above fetch - Console/JS etc.

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

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

Kudos to the April Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard > Microsoft Dynamics CRM (Archived)

#1
Mohamed Amine Mahmoudi Profile Picture

Mohamed Amine Mahmoudi 83 Super User 2025 Season 1

#2
Community Member Profile Picture

Community Member 52

#3
Victor Onyebuchi Profile Picture

Victor Onyebuchi 6

Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans