2017-07-07 45 views
1

我不知道如何創建綁定到賬戶的聯繫人。我有一個帳戶和聯繫人的csv文件,我想將這些數據導入到我的CRM中。這是我的代碼添加到CRM的帳戶:在CRM中創建賬戶聯繫人綁定C#

#region Column One Mappings 
// Create a column mapping for a 'text' type field. Ajouter un Compte 
ColumnMapping colMapping1 = new ColumnMapping() 
{ 
    // Set source properties. 
    SourceAttributeName = "my_new_accounts", 
    SourceEntityName = "Account_1", 

    // Set target properties. 
    TargetAttributeName = "name", 
    TargetEntityName = Account.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 colMappingId1 = _serviceProxy.Create(colMapping1); 
#endregion 

我想創建綁定到一個帳戶的許多聯繫人。

回答

0

您使用的示例代碼來自CRM SDK,該示例代碼還具有用於映射父帳戶查找映射的代碼。

// Create a lookup mapping to the parent account. 
     LookUpMapping parentLookupMapping = new LookUpMapping()......... 

查看此代碼塊,閱讀評論,根據您的需要實施它。

如果您只是試驗這種方法,請繼續。或者您可以使用OOB數據導入嚮導簡單地導入。