当我使用配置文件调试插件时,它工作正常,但没有任何反应.
IPluginExecutionContext context = localContext.PluginExecutionContext; IOrganizationService service = localContext.OrganizationService; EntityReference entity = (EntityReference)context.inputParameters["EntityMoniker"]; ColumnSet cols = new ColumnSet(); cols.AllColumns = true; Entity entityComplete = service.RetrIEve("task",entity.ID,cols); if (((OptionSetValue)entityComplete.Attributes["statecode"]).Value == 0) //se o status for cancelado ou concluído { if (entityComplete.Attributes.Keys.Contains("regardingobjectID") && ((EntityReference)entityComplete.Attributes["regardingobjectID"]).Logicalname == "incIDent") { queryExpression query = new queryExpression(); query.Entityname = "task"; query.ColumnSet = cols; query.linkEntitIEs.Add(new linkEntity("task","incIDent","regardingobjectID","incIDentID",Joinoperator.Inner)); query.Criteria.AddCondition(new ConditionExpression("statecode",Conditionoperator.Equal,0)); query.Criteria.AddCondition(new ConditionExpression("activityID",Conditionoperator.NotEqual,entityComplete.ID)); query.Criteria.AddCondition(new ConditionExpression("regardingobjectID",((EntityReference)entityComplete.Attributes["regardingobjectID"]).ID)); EntityCollection collection = service.RetrIEveMultiple(query); if (collection.EntitIEs.Count == 0) { Entity incIDent = service.RetrIEve("incIDent",((EntityReference)entityComplete.Attributes["regardingobjectID"]).ID,cols); SetStateRequest setState = new SetStateRequest(); setState.EntityMoniker = new EntityReference(); setState.EntityMoniker.ID = incIDent.ID; setState.EntityMoniker.Logicalname = incIDent.Logicalname; setState.State = new OptionSetValue(1); SetStateResponse setStateResponse = (SetStateResponse)service.Execute(setState); } } }
有人可以帮帮我吗?
谢谢.
我知道我使用过的实体,未能注册SetStateDynamic会导致插件无法触发.
总结以上是内存溢出为你收集整理的c# – CRM 2011 PLUGIN – PostTaskSetState全部内容,希望文章能够帮你解决c# – CRM 2011 PLUGIN – PostTaskSetState所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)