オンプレミスからオンライン ホストに契約をインポートしようとしています。SDK ソリューションの「dataimport」を微調整しましたが、必要なルックアップ属性に問題がありますCustomerIdName
。それは与えます
エラー 2147220654 「重複したルックアップ参照が見つかりました」
ルックアップ属性への別のマッピングはcontracttemplateid
問題なく機能します。account
これは、またはcontact
エンティティにマップできるという事実と関係があると思います。ソース ファイル (1 レコード行のみ) と以下のコード。ImportWithCreate
これは、sdk ソリューションに含まれるクラスに基づく 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