![]() |
#4 |
Участник
|
Вы не поняли.
В первом пунке описано почему ошибка: потому что у Вас зациклен плагин. А во втором просто замечание по коду. Теперь, чтобы не было повторного вызова кода плагина можно добавить в начале плагина проверку X++: if(!TargetEntity.Contains("bf_survey_tkcnt")) { QueryExpression token = new QueryExpression() { EntityName = "bf_surveytoken", ColumnSet = new ColumnSet(true) }; token.Criteria.AddCondition("bf_surveytoken_survey", ConditionOperator.Equal, TargetKey.Id); List<Entity> surveyTokens = crmService.RetrieveMultiple(token).Entities.ToList(); if (surveyTokens.Count > 0) { Entity survey = new Entity(TargetEntity.LogicalName); survey.Id = TargetEntity.Id; survey["bf_survey_tkcnt"] = surveyTokens.Count.ToString(); crmService.Update(survey); } } |
|
|
|