尝试将合同从内部部署导入在线主机。我调整了SDK解决方案“dataimport”但是我遇到了所需的查找属性CustomerIdName
。它给出了
错误2147220654“找到重复的查找引用”
查找属性contracttemplateid
的另一个映射可以正常工作。我认为这与可以映射到account
或contact
实体的事实有关。源文件(只有1个记录行)和下面的代码。这是基于sdk解决方案中包含的ImportWithCreate
类的1列映射。
title,activeon,allotmenttypecode,expireson,billingstarton,billingendon,
new_companyorindividual,CustomerIdName, Acme Consulting Company,
5/1/2000,1,1/23/2002,5/1/2000,1/23/2002,0,USF Admin
#region Column Eight Mappings
// Create a column mapping for a 'lookup' type field.
ColumnMapping colMapping8 = new ColumnMapping()
{
// Set source properties.
SourceAttributeName = "CustomerIdName",
SourceEntityName = "Contract_1",
// Set target properties.
TargetAttributeName = "customerid",
TargetEntityName = Contract.EntityLogicalName,
// Relate this column mapping with the data map.
ImportMapId =
new EntityReference(ImportMap.EntityLogicalName, importMapId),
// Force this column to be processed.
ProcessCode =
new OptionSetValue((int)ColumnMappingProcessCode.Process),
};
// Create the mapping.
Guid colMappingId8 = _serviceProxy.Create(colMapping8);
// Because we created a column mapping of type lookup, we need to specify lookup details in a lookupmapping.
// One lookupmapping will be for the parent account, and the other for the current record.
// This lookupmapping is important because without it the current record
// cannot be used as the parent of another record.
// Create a lookup mapping to the parent account.
LookUpMapping parentLookupMapping8 = new LookUpMapping()
{
// Relate this mapping with its parent column mapping.
ColumnMappingId =
new EntityReference(ColumnMapping.EntityLogicalName, colMappingId8),
// Force this column to be processed.
ProcessCode =
new OptionSetValue((int)LookUpMappingProcessCode.Process),
// Set the lookup for an account entity by its name attribute.
LookUpEntityName = Account.EntityLogicalName,
//LookUpEntityName = Contact.EntityLogicalName,
LookUpAttributeName = "name",
LookUpSourceCode =
new OptionSetValue((int)LookUpMappingLookUpSourceCode.System)
};
// Create the lookup mapping.
Guid parentLookupMappingId8 = _serviceProxy.Create(parentLookupMapping8);
// Create a lookup on the current record's "src_name" so that this record can
// be used as the parent account for another record being imported.
// Without this lookup, no record using this account as its parent will be imported.
LookUpMapping currentLookUpMapping8 = new LookUpMapping()
{
// Relate this lookup with its parent column mapping.
ColumnMappingId =
new EntityReference(ColumnMapping.EntityLogicalName, colMappingId8),
// Force this column to be processed.
ProcessCode =
new OptionSetValue((int)LookUpMappingProcessCode.Process),
// Set the lookup for the current record by its src_name attribute.
LookUpAttributeName = "CustomerIdName",
LookUpEntityName = "Contract_1",
LookUpSourceCode =
new OptionSetValue((int)LookUpMappingLookUpSourceCode.Source)
};
// Create the lookup mapping
Guid currentLookupMappingId8 = _serviceProxy.Create(currentLookUpMapping8);
#endregion
答案 0 :(得分:0)
我之前没有编写自己的数据导入脚本,但我看到了这个错误。
我怀疑这可能是因为您有两个名为“USF Admin”的联系人/帐户。
它试图找到查找字段的唯一记录,如果有重复,则不知道要设置哪个。
您还可以尝试使用标准CRM数据导入工具手动执行数据导入,如果代码或数据出现问题,这可能会帮助您缩小范围。
答案 1 :(得分:0)
没有重复。 Microsoft支持能够通过注释掉该特定的LookUpMapping的代码块来解决。
// LookUpMapping currentLookUpMapping = new LookUpMapping()