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!
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
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.
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/
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.
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
Siv Sagar
149
Super User 2025 Season 1
Muhammad Shahzad Sh...
61
Most Valuable Professional
Daivat Vartak (v-9d...
53
Super User 2025 Season 1