![]() |
#7 |
Участник
|
Я сомневаюсь, что мой код будет работать, хотя вроде должен.
Ну а так, если я правильно понял: Было: Код: if (!record.Contains("subject") || record["subject"].ToString() != uniq) { uniq = string.Format("{0}", uniq.Length > uniqLength ? (uniq.Substring(0, uniqLength - 3) + "...") : uniq); record["subject"] = uniq; crmService.Update(record); } Код: if (!record.Contains("subject") || record["subject"].ToString() != uniq) { uniq = string.Format("{0}", uniq.Length > uniqLength ? (uniq.Substring(0, uniqLength - 3) + "...") : uniq); record["subject"] = uniq; if(executionContext.MessageName == MessageName.Update) { crmService.Update(record); } } Код: Entity yourEntityName = (Entity)executionContext.InputParameters["Target"]; if(yourEntityName.Attributes.Contains("subject")) yourEntityName.Attributes["subject"] = yourEntityName.GetAttributeValue<EntityReference>("regardingobjectid").Name; if(executionContext.MessageName == MessageName.Update) { crmService.Update(yourEntityName ); } |
|