It seems that the architecture of the synchronization of leads from xDB to CRM has been changed in the the new version of CRM connectore module, 1.4.1.
It is working for Contact, where by default the contact is always getting identifed using the contact guid. But, for lead it is getting identified with the identifier value but the corresponding ID field is getting set to 00000000-0000-0000-0000-000000000000
and the entity is not getting inserted to CRM Lead.
For both lead and contact, the configuration has been done for a custom id field which is eventually the identifier in the XDB.
We have found that there is a new Queue processor in 1.4.1 - /sitecore/system/Data Exchange/BoschCrm/Queues/Queue Processors/Providers/Dynamics CRM/Queue Processor
for CRM Contacts
We updated the processor used in this item to a custom one, and changed the following attribute to leadid as below
public class LeadQueueProcessor : EntitiesProcessor
{
public LeadQueueProcessor()
{
this.AttributeToUpdateOnInsertedEntities = "leadid";
}
}
We then also got the code for the EntitiesProcessor class in our local and observed how it behaves for lead with leadid and then for contact with contactid.. Indside ProcessEntries method of this class, there is an issue, which we think should be fixed -
Dictionary<object, Entity> dictionary = new Dictionary<object, Entity>();
foreach (object key in (IEnumerable<object>)context.KeysToProcess)
{
Entity entity = workQueue.Get(key) as Entity;
if (entity == null)
{
this.Log(new Action<string>(logger.Error), "The specified key does not correspond to an entity. This processor was instructed to handle the entry, but it cannot.", string.Format("key: {0}", key));
return;
}
dictionary.Add(key, entity);
}
The keys from the context.KeysToProcess get set to the CRM contact guid for a contact but it is getting set to the identifier value for a lead. And then for a lead when it tries to load the entity using the piece of code - " Entity entity = workQueue.Get(key) as Entity;", an entity is created with an id of " 00000000-0000-0000-0000-000000000000
". This entity then never gets inserted to CRM Lead,.
For a contact, the key somehow gets set to contact guid and the items are updated in CRM. CRM pipeline batch and the corresponding pipelines are though not configured with this contactid in any of the steps.