Wednesday 1 July 2020

Entity mapping for fields in Microsoft Dynamics CE

Customizing entities is a norm when you extend in Dynamics CRM. I came across entity mapping twice so I decided to blog this as a reference to me and any other finding solution.

It quite easy to map attributes in entities with visible relationships in Dynamics CRM but for hidden relationships, you have to go through some steps to map these custom fields/attributes

Prerequisites before mapping:

Ensure there is an existing relationship between the entities and get the Mapping ID: You can confirm through

Get EntityMap Id

  • Get All Entity Maps: This displays a list of all mapping existing in your environment. 
[Organization URI]/api/data/v9.0/entitymaps?$select=sourceentityname,
targetentityname&$orderby=sourceentityname
Example
{"@odata.etag":"W/\"1145417\"","sourceentityname":"account", 
"targetentityname":"customeropportunityrole", 
"entitymapid":"57efb32f-b9ec-e911-a812-000d3a25c8cc"}, 

OR

  • Get a Specific Entity Map: Between SalesOrderDetail and InvoiceDetail
[Organization URI]/XRMServices/2011/OrganizationData.svc/EntityMapSet?$
select=EntityMapId&$filter=SourceEntityName eq "salesorderdetail" and
TargetEntityName eq "invoicedetail"
The EntityMapId will be the same

Create Mapping

Use the entitymapid
[Organization URI]/Tools/SystemCustomization/Relationships/Mappings/
mappingList.aspx?mappingId=57efb32f-b9ec-e911-a812-000d3a25c8cc

No comments:

Post a Comment