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 365 | Integration, Dataverse...
Suggested Answer

Retrieve and display Address ID values on entity form

(0) ShareShare
ReportReport
Posted on by

Hello Community,

When we create a contact record in Dynamics 365, and populate its Address 1 and Address 2 fields, the system automatically creates the system "Address" entity records corresponding to Address 1 and Address 2. Also, the id of the Address records created is set in the address1_addressid and address2_addressid fields in the Contact record.

Does anyone know if and how I can expose the address1_addressid and address2_addressid fields of the Contact record on a related entity form, so that I can show the values of those address IDs on the related entity form?

Thanks!

I have the same question (0)
  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Partner,

    If you want to show data on related entity forms from contact, you could use the following ways.

    1.Using Quick View Form for contact, and add your address fields on it and then show it on related entity forms.

    pastedimage1594016848709v1.png

    pastedimage1594016864973v2.png

    https://docs.microsoft.com/en-us/dynamics365/customerengagement/on-premises/customize/create-edit-quick-view-forms

    2.Create the field you want to show on related entity form, and use JS code to get the field value by webapi.

    Sample code:

    //get field value based on lookup field.
    function getValueByCustomer(executionContext){
        formContext=executionContext.getFormContext();
        var customer=formContext.getAttribute("customerid").getValue();
        if(customer != null){
            var customerId = customer[0].id.replace("{", "").replace("}", "");
            //get field value from related account 
            Xrm.WebApi.retrieveRecord("account", customerId, "?$select=fieldname").then(
                function success(result) {
                    //set value from account form to order form
                    formContext.getAttribute('new_fieldName').setValue(result.fieldname);
                },
                function (error) {
                    console.log(error.message);
                    // handle error conditions
                }
            );
        }
    
    }

    Best Regards,

    Leo

  • Suggested answer
    ACECORP Profile Picture
    1,589 on at

    You can use the Field Mapping feature of D365 to do that.

    See the following knowledge article for details https://itsolutions.bdo.ca/insights/using-field-mapping-in-microsoft-dynamics-crm-to-copy-data-between-associated-records/

  • Community Member Profile Picture
    on at

    Hi Jim,

    Thanks for your information.

    Unfortunately, I am looking to map the "primary key" value, not the regular field values. I don't think the field mapping via the relationships supports mapping of the primary key field from the source entity to another field on the related entity since the data type would be different.

    Basically, what I am trying to achieve is copy the primary key field value from the field "Address1_AddressId" from the Contact entity, to another field on a related entity. Using Quick View would not meet the requirement as I need this field to be directly on the related entity so I can query and perform other tasks I need to directly on the related entity.

  • LeoAlt Profile Picture
    16,331 Moderator on at

    Hi Eric,

    Thanks for your details.

    May I know that what the kind of the field "Address1_AddressId"? Since you want to store the primary key(ID) in it, is it lookup field or only text field?

    And if the contact has 1:N relationship between the related entity, then you could get the ID value from contact by JS I provided before.

    If the contact has N:1 relationship between the related, you need to use Power Automate(Flow) to get the ID value from contact.

    Regards,

    Leo

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 365 | Integration, Dataverse, and general topics

#1
Siv Sagar Profile Picture

Siv Sagar 93 Super User 2025 Season 2

#2
#ManoVerse Profile Picture

#ManoVerse 76

#3
Martin Dráb Profile Picture

Martin Dráb 66 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans