While working on one of the integration in my current project where we wanted to write data to CRM from CSV file which was placed on Blog storage on Azure.
We had the requirement to create Task record and also set owner field on CRM which is a multi entity lookup. Owner field can be either User or Team.
I will not provide set by step guide in this article to setup integration. See article here for step by step guide to load data from csv to CRM from Azure data factory.
In this post I will explain how we can set multi entity lookup field while writting data to Dynamics CRM from Azure data factory.
Trick is achieve this requirement to add another column in CSV which will tell the target entity to set for the lookup. See below CSV file which has ownerid column which is systemuser GUID and Target column which is target entity entity name for the owner lookup i.e systemuser.
If we need to set owner lookup to Team, We just need to set the target column value to team in csv.
Now In copy-activity column mapping, map the two columns as follows:
- Owner Id to ownerid. This mapping is the normal field mapping.
- Target to ownerid@EntityReference. The sink column is a virtual column representing the entity reference. Input such field names in a mapping, as they won’t show up by importing schemas.
Hope this helps!