如何在 MSCRM 中将查找值设置为空白或 null?
在 CRM 中设置查找值时,如果您不想更改任何内容,或者想将其设置为新值,则一切正常。但是,当您想要取消当前值时,具体方法尚不清楚。
例如,
house.new_associatepastorid = new HLCImport.CrmSdk.Lookup();
house.new_associatepastorid.type = EntityName.contact.ToString();
house.new_associatepastorid.value = Guid.Empty;
不起作用。
When setting a Lookup value in CRM everything works fine if you don't want to change anything, or if you want to set it to a new value. However, when you want to UNSET the current value, the way to do so is unclear.
For example,
house.new_associatepastorid = new HLCImport.CrmSdk.Lookup();
house.new_associatepastorid.type = EntityName.contact.ToString();
house.new_associatepastorid.value = Guid.Empty;
Does not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
设置 IsNull 和 IsNullSpecified 属性绝对没问题。对于更简单的代码,所有标准类型都有一个名为 Null 的静态成员。因此在这种情况下您可以使用 Lookup.Null。
Setting the IsNull and IsNullSpecified properties is absolutely fine. For simpler code, all of the standard types has a static member named Null. So in this case you could have used Lookup.Null.
我在SDK中找到了答案。您必须设置 isnull value = true,并设置 isnullspecified = true。您还不需要设置类型或值字段。所以代码是:
I found the answer in the SDK. You have to set the isnull value = true, as well as set the isnullspecified = true. You also need to not set the type or the value fields. So the code would be: