private List <string> GetTargetTypesToTry(Entity thisEntity, string field) { var targetTypesToTry = new List <string>(); if (!string.IsNullOrWhiteSpace(thisEntity.GetLookupType(field))) { targetTypesToTry.Add(thisEntity.GetLookupType(field)); } else { switch (XrmRecordService.GetFieldType(field, thisEntity.LogicalName)) { case Record.Metadata.RecordFieldType.Owner: targetTypesToTry.Add("systemuser"); targetTypesToTry.Add("team"); break; case Record.Metadata.RecordFieldType.Customer: targetTypesToTry.Add("account"); targetTypesToTry.Add("contact"); break; case Record.Metadata.RecordFieldType.Lookup: targetTypesToTry.Add(thisEntity.GetLookupType(field)); break; default: throw new NotImplementedException(string.Format("Could not determine target type for field {0}.{1} of type {2}", thisEntity.LogicalName, field, XrmService.GetFieldType(field, thisEntity.LogicalName))); } } return(targetTypesToTry); }