简体   繁体   English

从Dynamics CRM 2011升级到CRm 2016后遇到形式和插件的奇怪问题

[英]After upgrade from Dynamics CRM 2011 to CRm 2016 experiencing weird issue with forms and plugins

Client company just upgraded to 2016 from 2011. I've been testing the plugins to make sure they all still function and I've finally (after much frustration) figured out what is happening, but no idea why or how to resolve this. 客户公司从2011年刚刚升级到2016年。我一直在测试插件,以确保它们仍然可以运行,我终于(经过很多挫折)想出发生了什么,但不知道为什么或如何解决这个问题。

I have several plugins and they all function exactly as expected - as long as the updates to the data are not run through the forms. 我有几个插件,它们都完全按预期运行 - 只要不通过表单运行数据更新。

Let me explain: 让我解释:

I have plugins (Synchronous) that trigger on a change to a field. 我有插件(同步)触发更改字段。 If the field is changed via a workflow, or some other coded process, everything runs just fine. 如果通过工作流或其他编码过程更改字段,则一切运行正常。

But when I update the field on the form it's self. 但是,当我更新表单上的字段时,它就是自己的。 It fails with a very generic error (below). 它失败并出现非常一般的错误(如下)。

I support a couple of other clients already on 2016, and I'm not experiencing this same problem. 我已经在2016年支持其他几个客户,我没有遇到同样的问题。 So I'm not even sure where to begin. 所以我甚至不确定从哪里开始。 I've been going crazy here the last couple of days to check the code. 在过去的几天里,我一直在疯狂检查代码。 But it only happens when updating the field on the form. 但它只在更新表单上的字段时发生。 Every other method of updating the data that I have tested works with no errors. 更新我测试的数据的其他每种方法都没有错误。

I also have another issue. 我还有另一个问题。 When the field is updated (through a test workflow), it runs and updates a child record. 更新字段(通过测试工作流程)后,它将运行并更新子记录。 The child record then has a workflow that runs to deactivate the record. 然后,子记录具有运行以停用记录的工作流程。 The workflow says it ran and deactivated the record, but it never deactivates). 工作流程表示它运行并停用了记录,但它从不停用)。

Anyway. 无论如何。 if ANYONE has ANY idea at all about what could be causing this. 如果任何人对可能导致这种情况的原因有任何想法。 I would love to hear it. 我很乐意听到它。 I'm at my wits end on this. 我对此我的智慧结束了。

Thank you in advance. 先感谢您。

I've tested the code and had it run successfully, as long as I don't update the field through the form. 我已经测试了代码并让它成功运行,只要我不通过表单更新字段。 To test this I created some test workflows that update the data, they successfully run and the plugins fire off with no problems. 为了测试这一点,我创建了一些更新数据的测试工作流程,它们成功运行并且插件启动时没有任何问题。

EntityReference contact =    
(EntityReference)preImageEntity.Attributes["ipmahr_contact"];

QueryExpression cn = new QueryExpression("ipmahr_recertification");
cn.ColumnSet = new ColumnSet("ipmahr_contact", "statecode");
cn.Criteria.AddCondition("ipmahr_contact", ConditionOperator.Equal,  
contact.Id);
cn.Criteria.AddCondition("statecode", ConditionOperator.Equal, 0);

EntityCollection results1 = server.RetrieveMultiple(cn);

if (results1.Entities.Count > 0)
     foreach (Entity a in results1.Entities)
     {
      a.Attributes["ipmahr_deactivaterecertificationrecord"] =   true;
         server.Update(a);
     }    

The code is pretty straightforward in most cases, and works fine as long as things aren't updated on the form. 在大多数情况下,代码非常简单,只要表单上没有更新内容,代码就可以正常工作。

Here is the error: Exception: System.ServiceModel.FaultException`1[Microsoft.Xrm.Sdk.OrganizationServiceFault]: System.ServiceModel.CommunicationObjectFaultedException: #595EB751 (Fault Detail is equal to Microsoft.Xrm.Sdk.OrganizationServiceFault)., Correlation Id: fd1a79ca-c846-407b-b578-ac9207d6dd0e, Initiating User: 274d55dc-3f4d-e811-b30f-0050569142af Exiting Recertifications.Main.DeactivateUsedRecertificationsonEndDateChange.Execute(), Correlation Id: fd1a79ca-c846-407b-b578-ac9207d6dd0e, Initiating User: 274d55dc-3f4d-e811-b30f-0050569142af 以下是错误:异常:System.ServiceModel.FaultException`1 [Microsoft.Xrm.Sdk.OrganizationServiceFault]:System.ServiceModel.CommunicationObjectFaultedException:#595EB751(Fault Detail等于Microsoft.Xrm.Sdk.OrganizationServiceFault)。,Correlation Id :fd1a79ca-c846-407b-b578-ac9207d6dd0e,发起用户:274d55dc-3f4d-e811-b30f-0050569142af退出Recertifications.Main.DeactivateUsedRecertificationsonEndDateChange.Execute(),Correlation Id:fd1a79ca-c846-407b-b578-ac9207d6dd0e,发起用户: 274d55dc-3f4d-E811-b30f-0050569142af


New information. 新的信息。 I have found that not all the plugins I've written have an issue on this server. 我发现并非所有我编写的插件在这台服务器上都有问题。 This is good. 这很好。 But I also found that there is a commonality on those plugins that do fail. 但我也发现那些失败的插件存在共性。

Any plugin using a Query Expression fails with the generic error. 任何使用查询表达式的插件都会因一般错误而失败。 Adding robust error checking didn't show anything (once error checking was added, it just didn't run anything, and didn't produce any errors in the logs). 添加强大的错误检查没有显示任何内容(一旦添加了错误检查,它只是没有运行任何东西,并且没有在日志中产生任何错误)。 Trace logs didn't show anything significant either. 跟踪日志也没有显示任何重要信息。

So now I'm wondering if there is something in the way the Query Expression is formatted, or if there is an issue with the SQL. 所以现在我想知道查询表达式的格式是否存在,或者SQL是否存在问题。 I mention SQL because I found this morning that if I create fields too fast, I get a generic SQL error. 我提到SQL是因为我今天早上发现如果我创建的字段太快,我会得到一个通用的SQL错误。 Wait a minute and I can create new fields without a problem. 等一下,我可以毫无问题地创建新字段。

I think it likely that this plugin is not actually failing based on the error you are receiving and the fact that it happens conditionally. 我认为这个插件可能根据你收到的错误以及它有条件地发生的事实而实际上没有失败。 More likely, your server.Update(a); 更有可能的是,你的server.Update(a); call is resulting in a failure within a secondary plugin or workflow action triggered by update of the Recertification record. 调用导致更新重新认证记录触发的辅助插件或工作流操作失败。
- Comment out that line and verify that the plugin works - 注释掉该行并验证插件是否有效
- See if you can reproduce a failure by directly updating that field on the Recertification record - 通过直接更新重新认证记录中的该字段,查看是否可以重现故障
- Review plugin/workflows running against the Recertification entity - 查看针对重新认证实体运行的插件/工作流程

Most likely this has one of the following root causes: 很可能这有以下根本原因之一:
- A security issue based on different executing users between the form update or workflow update - 基于表单更新或工作流更新之间的不同执行用户的安全问题
- Other tangential fields are being updated by one or the other of those two methods which subsequently cause different behavior in a secondary plugin/workflow - 其他切向字段正在通过这两种方法中的一种或另一种进行更新,这些方法随后会导致二次插件/工作流中的不同行为

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

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