Microsoft CRM Plugin Infinite Loop

后端 未结 4 1391
孤城傲影
孤城傲影 2020-12-22 00:59

Another MS CRM question from me, I\'m afraid. I\'ve got the following code being executed on the update of a contact record but it gives me an error saying the job was cance

4条回答
  •  不知归路
    2020-12-22 01:34

    **I went through a lot of trial and error. I don't know why plugin context does not work but this works but the parentcontext works. This (workaround?) works :) **

                if (this.Context.ParentContext != null && this.Context.ParentContext.ParentContext != null)
                {
                    var assemblyName = Assembly.GetExecutingAssembly().GetName().Name;
    
                    if (!this.Context.ParentContext.ParentContext.SharedVariables.Contains(assemblyName))
                    {
                        this.Context.ParentContext.ParentContext.SharedVariables.Add(assemblyName, true.ToString() );
                    }
                    else
                    {
                       // isRecursive = true;
                      return;
                    }
                }

提交回复
热议问题