You know what!. We can map fields with the related entity without using any client-side script. It can be done by the Out-of-Box feature, which is Entity Field Mapping. But that entities must be related with 1:N relationship. But there are some limitations such as we can map the fields that must be of same type and format. For example, We can map a field from account entity with the contact entity.
As this kind of field mappings works on the scenarios where we create the child records from parent record. In case of creating a child record independently by the main form or any other way, the entity field mapping doesn't work. I have created the entity field mapping by following the below steps.
- Create a new custom field in Account and Contact entity. And I have created a text field and named it Test Mapping Field.
- As the account has 1:N relationship with contact. We don't need to do anything with the relationship here. If you are using a custom entity, you need to create a 1:N relationship between them.
- Switch to the classic mode, Navigate to Account Entity 🡲 Click on the 1:N relationship(contact_customer_accounts)
- After opening the relationship, click on the mapping on the left side pane.
- In the Mapping page, Create a new mapping by clicking on the new button
- A pop-up for creating a field mapping opens up, and select fields to map. I will map my custom field from account to contact.
- Navigate to the form editor for Accounts Entity 🡲 Edit the Main form 🡲 Add the field to the form, then save and publish.
- Navigate to the form editor for Contacts Entity 🡲 Edit the Quick Create form 🡲 Add the field to the form, then save and publish.
- Add any value to the custom field which we added in accounts form. Then save the record.
- You will find the value which we gave in the Account Main form will come over to the Contact create form.
By this way, we can achieve the mapping of fields with the related entity using Out-of-the-Box feature (without coding). You can refer the Microsoft Documentation on Entity field mapping here
Have a good day!