简体   繁体   English

MS Dynamics CRM 365-从Excel文件导入数据

[英]MS Dynamics CRM 365 - import data from Excel files

I'm getting into MS Dynamics CRM 365 programming, and have been dealing with data imports of lookup / reference entities. 我正在进入MS Dynamics CRM 365编程,并且一直在处理查找/引用实体的数据导入。

I created a new entity with just the default Name column, stored and published it, and then went to look at in CRM. 我仅使用默认的Name列创建了一个新实体,将其存储并发布,然后在CRM中进行了研究。 From the default "main" view, I choose the "Data Import" option and downloaded a template .xlsx file, which I then filled out. 在默认的“主”视图中,我选择“数据导入”选项并下载了模板.xlsx文件,然后填写了该文件。 After that, I chose "Import Data" and uploaded this filled out .xlsx , and it was submitted, parsed, transformed successfully and the rows I had entered show up as expected. 之后,我选择了“导入数据”并上传了填写好的.xlsx ,它已成功提交,解析,转换并且输入的行按预期显示。

So far, so good. 到现在为止还挺好。

Now I created a second lookup entity (again with just the Name field), published it, and thought I'd be smart and just "re-use" that .xlsx "template" I had downloaded for the first lookup entity, and enter the new values for the second lookup entity, and then upload this manually "recycled" file. 现在,我创建了第二个查找实体(同样只有Name字段),并将其发布,并认为我很聪明,只是“重复使用”我为第一个查找实体下载的.xlsx “模板”,然后输入第二个查询实体的新值,然后手动上载此“回收的”文件。 I did change the file name of the .xlsx , as well as the worksheet name, to match the name of the second lookup entity. 我确实更改了.xlsx的文件名以及工作表名称,以匹配第二个查找实体的名称。

And while the upload, the parsing and transforming worked just fine - the actual rows I had inserted ended up in the first lookup entity... 在上载的同时,解析和转换也很好-我插入的实际行最终出现在第一个查找实体中...

So my conclusion is: somewhere , CRM must keep track of what entity that .xlsx was indended for - and it's neither the file name of the .xlsx , nor the name of the worksheet (which I had also updated) - it must be stored somewhere else. 所以我的结论是:CRM必须在某个位置跟踪.xlsx所针对的实体 - 它既不是 .xlsx的文件名, 也不是工作表的名称(我也已更新)-它必须存储别的地方。

Does anyone know where?? 有人知道吗? Can I change it somehow (manually or programmatically)? 我可以以某种方式(手动或编程)更改它吗?

After I went through the full cycle again (download import template .xlsx , fill that out, upload that file) - it works just fine for the second lookup entity, too. 在我再次经历了整个周期之后(下载导入模板.xlsx ,填写该文件,然后上传该文件)-第二个查找实体也可以正常工作。

There will be a hidden sheet in Excel file, but we cannot unhide it. Excel文件中将有一个隐藏的工作表,但我们无法取消隐藏它。 That's where all the configurations are stored. 这就是所有配置的存储位置。

But you can see it when you do something like explained in this blog , you have to click “View code” option from context menu, by right clicking sheet name tab in Excel file. 但是,当您执行此博客中所述的操作时 ,您可以看到它,您必须在上下文菜单中单击“查看代码”选项,方法是右键单击Excel文件中的工作表名称标签。

Then by opening the “Project explorer”, the hidden sheet will be visible in VBA, set the visibility to 1 – xlSheetVisible . 然后,通过打开“项目资源管理器”,隐藏的工作表将在VBA中可见,将可见性设置为1 – xlSheetVisible Don't save anything. 不要保存任何东西。

在此处输入图片说明

I believe the issue lies in the hidden first three columns, the first of which contains the entity name in the header. 我认为问题出在隐藏的前三列中,其中第一列包含标题中的实体名称。

When working with import templates, especially when exporting for reimport, these columns are key. 在使用导入模板时,尤其是在导出以进行重新导入时,这些列是关键。 The first column holds the Guid of the record, the checksum tells the system if the user touched the data in the row, and the modifiedOn allows the system to know if the data was changed in the system after the export. 第一列保存记录的Guid,校验和告诉系统用户是否触摸了行中的数据,而ModifyOn允许系统知道导出后系统中的数据是否已更改。

隐藏的栏

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM