Mapping streamlines data entry when a user creates new records that are associated with another record. When an entity has a relationship with another entity, you can create new related entity records from the associated view visible on the primary entity. When the user creates a new record from an associated view, mapped data from the primary entity record is copied to the form for the new related entity record. You control what data is copied by adding new mappings in the relationship between the two entities. If a record is created any way other than from the associated view of the primary entity, data is not mapped. Notice that if there are multiple relationships between the same pair of entities, there is only one entity map. This map will have to be used for mapping fields for both relationships.
For example, you might want to set up a mapping between the address fields in accounts and the address fields in contacts so that when a user adds a contact associated with a specific account, the address fields for the contact are filled in automatically.
You can map one attribute to multiple target attributes. For example, you can map address information in an account to both the billing and shipping addresses in an order.
Mapping only applies just before a new record is created from an associated view. A user can make changes the record is saved, and changes that are made later to the data in the primary record are not applied to the related record.
The below plug-in assembly will keep the data synchronized on subsequent updates. So now data mapping will work not only when you create the child record the first time but also whenever you update the attributes in the parent record the attributes on the child record will be updated.
Default Account Address:
Default related contact address
Basically the contact will inherit the parent account address due to the mapping between the account and contact entity.
This will only take effect the first time you create a contact from the account form.
Account address updated
Account address is updated which fired the post-update plug-in
Related contact address updated
Account post-update plug-in will update the contact address with the same value of the account address
Source code of the plug-in assembly:
Hope you’ll find this usefull.
Benjamin LECOQ (Code by Fouad Rachkidi)