mscrm导入更新列映射引用属性

时间:2018-05-13 11:05:44

标签: import mapping dynamics-crm updates

我在Dynamics 365上工作,我需要使用导入实体开发记录的动态更新。

我设法动态导入以创建Dynamics 365的记录但是为了更新,我有这样的信息: “此属性未映射为引用属性。但是,您已为其包含了一个ReferenceMap。修复此不一致性,然后再次导入此数据映射。”

好吧,即使在微软网站上,即使在网络上也没有找到任何文档。我希望能找到你们的帮助;)

请参阅我的代码,了解有关我的参考ID映射的列映射:

import csv
import pywikibot

with open('0.csv', 'r') as csvfile:
    reader = csv.reader(csvfile,delimiter="~")
    for row in reader:
    #if len(row) == 8:
        wikiPage1 = row[0]
        indexPages = row[5]
        print (wikiPage1)

        site = pywikibot.Site('ta', 'wiktionary')
        page1 = pywikibot.Page(site, wikiPage1)

        page1.text = page1.text.replace('Number','எண்')
        page1.save(summary=''Number --> எண்') 

请参阅我的有关导入的代码:

Entity colMapping = new Entity(CrmColumnmapping.EntityLogicalName);
colMapping.Attributes.Add(CrmColumnmapping.Fields.SourceAttributeName, dc.Caption);
colMapping.Attributes.Add(CrmColumnmapping.Fields.SourceEntityName, "MySource");
colMapping.Attributes.Add(CrmColumnmapping.Fields.TargetAttributeName, dc.ColumnName);
colMapping.Attributes.Add(CrmColumnmapping.Fields.TargetEntityName, dt.TableName);
colMapping.Attributes.Add(CrmColumnmapping.Lookups.ImportMapId, new EntityReference(CrmImportmap.EntityLogicalName, importMap.Id));
colMapping.Attributes.Add(CrmColumnmapping.OptionSets.ProcessCode, new OptionSetValue(CrmColumnmapping.OptionSets.ProcessCodeValues.Option1_Process));
colMapping.Id = service.Create(colMapping);

Entity parentLookupMapping = new Entity(CrmLookupmapping.EntityLogicalName);
parentLookupMapping.Attributes.Add(CrmLookupmapping.Lookups.ColumnMappingId, colMapping.ToEntityReference());
parentLookupMapping.Attributes.Add(CrmLookupmapping.OptionSets.ProcessCode, new OptionSetValue(CrmLookupmapping.OptionSets.ProcessCodeValues.Option1_Process));
parentLookupMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpAttributeName, dc.Namespace + "id");
parentLookupMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpEntityName, dc.Namespace);
parentLookupMapping.Attributes.Add(CrmLookupmapping.OptionSets.LookUpSourceCode, new OptionSetValue(CrmLookupmapping.OptionSets.LookUpSourceCodeValues.Option2_System));
parentLookupMapping.Id = service.Create(parentLookupMapping);

Entity currentLookUpMapping = new Entity(CrmLookupmapping.EntityLogicalName);
currentLookUpMapping.Attributes.Add(CrmLookupmapping.Lookups.ColumnMappingId, colMapping.ToEntityReference());
currentLookUpMapping.Attributes.Add(CrmLookupmapping.OptionSets.ProcessCode, new OptionSetValue(CrmLookupmapping.OptionSets.ProcessCodeValues.Option1_Process));
currentLookUpMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpAttributeName, dc.ColumnName);
currentLookUpMapping.Attributes.Add(CrmLookupmapping.Fields.LookUpEntityName, dt.TableName);
currentLookUpMapping.Attributes.Add(CrmLookupmapping.OptionSets.LookUpSourceCode, new OptionSetValue(CrmLookupmapping.OptionSets.LookUpSourceCodeValues.Option1_Source));
currentLookUpMapping.Id = service.Create(currentLookUpMapping);

如果有人知道如何映射引用属性(例如:systemuserid)以管理动态更新导入,那么将不胜感激。

非常感谢

0 个答案:

没有答案