web
You’re offline. This is a read only version of the page.
close
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

I have the same question (0)
  • Suggested answer
    Sreevalli Profile Picture
    3,256 on at

    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.

  • Verified answer
    gdas Profile Picture
    50,091 Moderator on at

    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.

  • Community Member Profile Picture
    on at

    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
    Mick_4711 Profile Picture
    552 on at

    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?

  • gdas Profile Picture
    50,091 Moderator on at

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

  • gdas Profile Picture
    50,091 Moderator on at

    This is not the right answers you verified.

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans