Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

CRM FetchXML Parent Company Name Attribute

Posted on by Microsoft Employee

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
    gdas 50,085 on at
    RE: CRM FetchXML Parent Company Name Attribute

    This is not the right answers you verified.

  • gdas Profile Picture
    gdas 50,085 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
    Mick_4711 550 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
    Community Member Microsoft Employee 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
    gdas 50,085 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
    Sreevalli 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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans