简体   繁体   English

Microsoft Dynamics CRM 2011:使用SQL更新查找字段

[英]Microsoft Dynamics CRM 2011: Updating a lookup field using SQL

I have thousands of incidents in my CRM that are either resolved or cancelled. 我的CRM中有成千上万个已解决或已取消的事件。 We have added a new lookup field to incident's form recently but of course incidents that are already closed do not have any value in it. 我们最近在事件的表单中添加了一个新的查找字段,但是当然,已经关闭的事件没有任何价值。 It is essential to populate that lookup field for all incidents. 必须为所有事件填充该查找字段。

I tried to create a console application that would have updated all closed incidents but apparently I can't update an incident unless I activate it first. 我试图创建一个控制台应用程序,该应用程序将更新所有已关闭的事件,但显然除非先激活它,否则我无法更新事件。

Reopening (and then closing again) any incident at this point is pretty much not wanted solution. 此时,重新打开(然后再次关闭)任何事件几乎是不需要的解决方案。

So I was wondering updating that lookup field by writing simple SQL statement. 所以我想知道通过编写简单的SQL语句来更新该查找字段。 I know this is highly unsupported so my question is what could possible go wrong? 我知道这是高度不受支持的,所以我的问题是什么可能出问题? I tried to update one incident by using SQL and it seems to work but before I update all of them I want to know why I should no do this? 我试图通过使用SQL更新一个事件,它似乎可以工作,但是在更新所有事件之前,我想知道为什么我不应该这样做吗? Is it enough to update that one lookup field in a database table (to put relevant GUID into it) or is there something else I should update too? 是否足以更新数据库表中的一个查找字段(以将相关的GUID放入其中),还是我还要更新其他内容?

Or if you have any other solutions how I could populate that field without reopening an incident I'd be happy to hear it. 或者,如果您有任何其他解决方案,我可以在不重新发生事件的情况下填充该字段,那么我将很高兴听到它。

As you already found by SDK you need to reactivate the incident first. 正如SDK所发现的那样,您需要先重新激活事件。

By SQL is unsupported and is preferable to avoid direct updates. 不支持使用SQL,最好避免直接更新。

You can face some issues with the SQL way, for example workflows will not be triggered by SQL updates, in your case probably you will not face issues updating closed incidents (probably you need this lookup filled for reporting requirements). 您可能会遇到一些SQL方式的问题,例如,工作流将不会由SQL更新触发,在您的情况下,您可能不会遇到更新已关闭事件的问题(可能需要满足查询要求的查找)。

As far as I know if you want to go with SQL you need to update only the single attribute. 据我所知,如果要使用SQL,则只需更新单个属性。

Up to you the final decision. 由您决定。

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

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