Dynamics 365-为什么查到的Record的Id是Guid初始值
通过代码查询CRM数据,这个是开发经常会碰到的情况,获取返回的EntityCollection之后,我们会拿Entity.Id做进一步操作。笔者最近碰到的情况,是Entity.Id是个初始值。先上一段FetchXml:
private string FetchAccountFromContact = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
"<entity name='account'>" +
"<attribute name='name' />" +
"<attribute name='new_bdrassigned' />" +
"<attribute name='ownerid' />" +
"<order attribute='name' descending='false' />" +
"<link-entity name='contact' from='parentcustomerid' to='accountid' link-type='inner' alias='ac'>" +
"<filter type='and'>" +
"<condition attribute='contactid' operator='eq' value='{0}' />" +
"</filter>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
查询Code:
FetchAccountFromContact = string.Format(FetchAccountFromContact, contactId);
FetchExpression expression = new FetchExpression(FetchAccountFromContact);
EntityCollection accounts = service.RetrieveMultiple(expression);
这套查询操作,初看没什么问题,但是当用最后的accounts,来做进一步的处理的时候,问题来了:

Id是Guid的初始值,并不是我们期望的真正的Record的Id。
问题原因:
在FetchXml那里,我们还需要加一个attribute,就是accountid。
private string FetchAccountFromContact = "<fetch version='1.0' output-format='xml-platform' mapping='logical' distinct='true'>" +
"<entity name='account'>" +
"<attribute name='name' />" +
"<attribute name='accountid' />" +
"<attribute name='new_bdrassigned' />" +
"<attribute name='ownerid' />" +
"<order attribute='name' descending='false' />" +
"<link-entity name='contact' from='parentcustomerid' to='accountid' link-type='inner' alias='ac'>" +
"<filter type='and'>" +
"<condition attribute='contactid' operator='eq' value='{0}' />" +
"</filter>" +
"</link-entity>" +
"</entity>" +
"</fetch>";
然后再次查询就会发现Id有值了

Dynamics 365-为什么查到的Record的Id是Guid初始值的更多相关文章
- Dynamics 365中显示格式为URL的字段极少部分URL值录入了不显示怎么回事?
微软动态CRM专家罗勇 ,回复318或者20190315可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 对于如下类型的字段, ...
- 安装完成Dynamics 365 CE后别忘了更改维护作业的运行时间
摘要: 微软动态CRM专家罗勇 ,回复309或者20190308可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 安装完毕Dy ...
- Introduction to Microsoft Dynamics 365 licensing
Microsoft Dynamics 365 will be released on November 1. In preparation for that, Scott Guthrie hosted ...
- 自定义工作流活动报错:您无法登陆系统。原因可能是您的用户记录或您所属的业务部门在Microsoft Dynamics 365中已被禁用。
本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复265或者20170926可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong.me ...
- 介绍Dynamics 365的OrgDBOrgSettings工具
摘要: 微软动态CRM专家罗勇 ,回复320或者20190320可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!我的网站是 www.luoyong.me . 有时候会需要 ...
- 轻量级应用程序Dynamics 365 App for Outlook介绍
摘要: 本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复273或者20180625可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyon ...
- Dynamics 365 Online-Microsoft Flow
自December 2016 update for Dynamics 365 (online)之后的Online版本,Dynamics 365有了个新Feature:Microsoft Flow Co ...
- Dynamics 365工作流报错:您无法登陆系统。原因可能是您的用户记录或您所属的业务部门在Microsoft Dynamics 365中已被禁用。
本人微信和易信公众号: 微软动态CRM专家罗勇 ,回复265或者20170926可方便获取本文,同时可以在第一间得到我发布的最新的博文信息,follow me!我的网站是 www.luoyong.me ...
- Dynamics 365 Online-Relevance Search
区别于Quick Find,以及Full-Text Quick Find,Dynamics 365 Online有了一个特有的Search功能:Relevance Search.至于为什么是Onlin ...
随机推荐
- SpringBoot之旅第五篇-数据访问
一.引言 大部分系统都离不开数据访问,数据库包括SQL和NOSQL,SQL是指关系型数据库,常见的有SQL Server,Oracle,MySQL(开源),NOSQL是泛指非关系型数据库,常见的有Mo ...
- SpringCloud学习系列之五-----配置中心(Config)和消息总线(Bus)完美使用版
前言 在上篇中介绍了SpringCloud Config的使用,本篇则介绍基于SpringCloud(基于SpringBoot2.x,.SpringCloud Finchley版)中的分布式配置中心( ...
- 请给你的短信验证码接口加上SSL双向验证
序言 去年年底闲来几天,有位同事专门在网上找一些注册型的app和网站,研究其短信接口是否安全,半天下来找到30来家,一些短信接口由于分析难度原因,没有继续深入,但差不多挖掘到20来个,可以肆意被调用, ...
- 【原】无脑操作:IDEA + maven + Shiro + SpringBoot + JPA + Thymeleaf实现基础认证权限
开发环境搭建参见<[原]无脑操作:IDEA + maven + SpringBoot + JPA + Thymeleaf实现CRUD及分页> 需求: ① 除了登录页面,在地址栏直接访问其他 ...
- 4. [mmc subsystem] mmc core(第四章)——host模块说明
零.说明 对应代码drivers/mmc/core/host.c,drivers/mmc/core/host.h. 为底层host controller driver实现mmc host的申请以及注册 ...
- FPGA高速ADC接口实战——250MSPS采样率ADC9481
一.前言 最近忙于硕士毕业设计和论文,没有太多时间编写博客,现总结下之前在某个项目中用到的一个高速ADC接口设计部分.ADC这一器件经常用于无线通信.传感.测试测量等领域.目前数字系统对高速数据采集的 ...
- Gaussian Mixture Models and the EM algorithm汇总
Gaussian Mixture Models and the EM algorithm汇总 作者:凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ 1. 漫谈 ...
- Python中星号的本质和使用方式
翻译:Python 开发者 - 一汀, 英文:Trey Hunner http://blog.jobbole.com/114655/ Python开发者 在 Python 中有很多地方可以看到*和** ...
- Window10升级遇到大坑错误代码:0xc000000e完美解决方案
昨天忽然升级了,然后并没有立即重启更新,因为但是正在工作所以等下班回到家后就是一直提示:文件:\Windows\system32\winload.efi 错误代码:0xc000000e!!! 如下图所 ...
- PHP全栈学习笔记4
php和JavaScript,掌握JavaScript基础,自定义函数,流程控制语句,事件,调用JavaScript脚本,在PHP中使用JavaScript. JavaScript是网景公司开发的,是 ...