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)

Querying Contact entity

(1) ShareShare
ReportReport
Posted on by 2,665

Hi,

I am trying to query contact entity and I realized for address fields there is a seperate entity called 'CustomerAddress'. Now to query for a contact record, I did a join on both the tables and I am seeing two records for each contact record. WHy is that so?

I really want to query for all the contacts along with the address fields from customeraddress table and do some validation to create new records or update existing records. Please suggest your ideas on this.

Thanks for any help.

*This post is locked for comments

I have the same question (0)
  • Royal King Profile Picture
    27,686 on at

    You can query just contact to get all the address information.

    The account and contact entity have address1_street1, address1_city, address1_stateorprovince, etc. and a set of address2 fields. When an account or a contact is created the values entered in these fields are stored in the customer address entity. So, the fields on the account or contact are pointers to the records in the address entity. If the values are not entered in these fields CRM creates two blank records in the customer address entity. CRM takes care of keeping these two entities in sync. If the address values are changed on the account or the contact record, the associated records in the customer address entity are updated automatically.

    The first two Address (address1 and address2) records that the CRM creates are hidden in the “More Addresses” associated view on the Account or Contact  

  • crmprogrammer2013 Profile Picture
    2,665 on at

    If I query only contact, I don't see address fields. I do need address fields to map with some incoming data for validations.

  • Mahendar Pal Profile Picture
    45,095 on at

    As already said you can get your primary address from contact itself, can share your query how you are doing it??

  • Suggested answer
    Community Member Profile Picture
    on at

    Each Contact will have two entries in the customeraddress table, so you will get two rows.

    But you don't need to go anywhere near the tables, and really you should not do so. Tables are subject to schema changes, so any reports or code relying on them might break later after an upgrade (especially if you upgraded to 2013 and deferred the table merge process, which become mandatory when upgrading to 2015).

    Instead use the filtered views, in this case filteredcontacts.

    These are denormalised to include things like labels for lookup, option set and two options field, as well as commonly-joined tables such as customeraddress.

    So for Account, Contact and Lead the address fields are right there in the filtered views without any further effort on your part.

  • Suggested answer
    Hamzeh Zawahreh Profile Picture
    3,674 on at

    hi, you don't need to query the tow tables, the address is already in the contact entity so you can just select them in views or reports.

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