MB2-716 (Microsoft Dynamics 365 Customization and Configuration) – Entity Mapping

As I prepare for my MB2-716 exam I’m producing a series of blog posts that collectively should help others revising for the MB2-716 Certification. (Microsoft Dynamics 365 customization and Configuration.) This time I will look at entity mapping.

Entity mapping is an “extension” to relationships that allows us to map fields. This can be really useful when creating new related records. Consider the process for creating a new contact related to the account. When we do this there are lots of fields that could be usefully defaulted on the new contact. (Including things like phone number and address.)

An important concept with entity mapping is that the mapping only applies when new records are created directly from the parent.

Mapping is NOT designed to keep the fields synchronised it simply defaults them when new records are created. Meaning mapping is never applied on the update of records.

As the fields on the related entity are simply defaulted it does mean that users can edit (or remove) this information before saving. For example, the contacts phone number might usefully be defaulted to match th e account. But sometimes the contact will have a different phone number and this might be changed before saving the contact.

It is possible to map one field on the parent entity to multiple fields on the child entity. To illustrate this I’ve shown how I can map address line 1 on the account to address line 1 of both the shipping address and the bill to address on an order.

It is important to understand that the mapping can only occur when the child record is created directly from the parent. For example, when creating a contact the mapping will only take effect if I first load the account and create the contact from the account form. I have shown this concept below by creating a contact from my account. Notice how the address and phone number fields are pre-populated. This is because they have been defaulted from the values held on my account.

If I have created the contact outside the context of the account this mapping could not and would not have happened.

Data types, when you map a field the data types must match. If you try to try to create an invalid mapping, the error shown below will be displayed.

Take a moment to consider the possible errors mentioned in this error message.

  • The data type must match – meaning single line to text to single line of test. Or currency to currency etc.
  • The length of the target field cannot be shorter than the source field – meaning you can’t map a text field that is 100 characters long to a field that is 10 long. (But you could map one that is 10 long to one that is 100 long!)
  • The format should match – text fields (for example) can have formatting. As they can hold phone numbers, urls, email addresses etc. Any formatting options muct be the same on the source and target fields.
  • The target field must not be used in another mapping – We can map one source field to multiple targets. But each target can only exist once.
  • The source field must be visible on the entity form – meaning to map phone number from the account to the contact, phone number must show on the account form.
  • The target field must be a field a user can enter data into – See note below!
  • Address ID values cannot be mapped – you can map individual address fields but you cannot map the address ID field. (An internal GUID used to hold addresses.)

Note : I wanted to review what was implied by the comment “target field must be a field a user can enter data into”. So I did some testing! I thought of three combinations which could come into play here;

  1. The field is read-only on the form … in this circumstance the mapping applied and the child record was correctly saved with the field populated.
  2. The field is not on the form … in this circumstance the mapping applied and the child record was correct saved with the field populated.
  3. The field is restricted using field security profile …. If you map something into a field but you don’t have the security privilege to create that field an error will be given.

Create a Mapping

To create a mapping simply open the parent entity in the customizations area of Dynamics 365. And select the required relationship.

On the relationship you will have the mappings option, use the “New” button to create a mapping.

Having selected “New” you can enter the source and target field information. (Keeping in mind the restrictions on field types (etc) discusses above.

I hope this post has given you a detailed overview of entity mapping in Dynamics 365 and will serve as useful information whilst revising for the MB2-716 exam.

One thought on “MB2-716 (Microsoft Dynamics 365 Customization and Configuration) – Entity Mapping

  1. Pingback: MB2-716 Certification: (Microsoft Dynamics 365 Customization and Configuration) – Revision Guide | Microsoft Dynamics 365 and Unified Service Desk

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s