![]() |
#1 |
Участник
|
Получить id объекта вызвавшего PlugIn
Как получить уникальный идентификатор кокретного Entity который вызвал срабатывание PlugIn-а?
Такой метод даст результат?: public void Execute(IPluginExecutionContext context) ............................... context.InputParameters.Properties["id"].ToString() ...............................
__________________
Сергей Осипов, MCTS:SQL Server 2005, ООО "Программные технологии", Самара |
|
![]() |
#2 |
Moderator
|
Должен. Но проще проверить.
![]()
__________________
http://fixrm.wordpress.com, снятие/наведение порчи. Быстро, дорого, гарантия. ![]() ![]() |
|
![]() |
#3 |
Участник
|
Согласен что проще!
Но админ который может меня добавить в группу деплоймент администратор будет только завтра. Не могу плагин пока зарегестрировать а сроки поджимают - пишу в слепую с оглядкой на примеры в SDK, да на помощь в форуме... ![]()
__________________
Сергей Осипов, MCTS:SQL Server 2005, ООО "Программные технологии", Самара |
|
![]() |
#4 |
Участник
|
Некий универсальный код...
Некий универсальный код...
Код: _message = context.MessageName; switch(_message) { case MessageName.Create: case MessageName.DeliverIncoming: if (context.InputParameters.Contains(ParameterName.Target) && context.InputParameters[ParameterName.Target] is DynamicEntity) { DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties[ParameterName.Target]; _entityName = entity.Name.ToLower(); } if (context.Stage == MessageProcessingStage.BeforeMainOperationOutsideTransaction) { // EntityId is not available in Pre-stage } else { if(context.OutputParameters.Contains(ParameterName.Id)) _entityId = (Guid)context.OutputParameters[ParameterName.Id]; else if (context.OutputParameters.Contains(ParameterName.EmailId)) _entityId = (Guid)context.OutputParameters[ParameterName.EmailId]; } break; case MessageName.Update: if (context.InputParameters.Contains(ParameterName.Target) && context.InputParameters[ParameterName.Target] is DynamicEntity) { DynamicEntity entity = (DynamicEntity)context.InputParameters.Properties[ParameterName.Target]; _entityName = entity.Name.ToLower(); _entityId = ((Key)entity.Properties[_entityName + "id"]).Value; } break; case MessageName.Delete: case MessageName.Assign: case MessageName.GrantAccess: case MessageName.Handle: if (context.InputParameters.Contains(ParameterName.Target) && context.InputParameters[ParameterName.Target] is Moniker) { Moniker moniker = (Moniker)context.InputParameters[ParameterName.Target]; _entityName = moniker.Name.ToLower(); _entityId = moniker.Id; } break; case MessageName.SetState: case MessageName.SetStateDynamicEntity: if (context.InputParameters.Contains(ParameterName.EntityMoniker) && context.InputParameters[ParameterName.EntityMoniker] is Moniker) { Moniker moniker = (Moniker)context.InputParameters[ParameterName.EntityMoniker]; _entityName = moniker.Name.ToLower(); _entityId = moniker.Id; } break; } _entityName - имя сущности записи |
|
![]() |
#5 |
Участник
|
Идём сюда:
http://code.msdn.microsoft.com/crmpl...?ReleaseId=443 Скачиваем SamplePlugins.zip Вынимаем оттуда PluginHelper.cs и вставляем в свой плагин Пользуемся на здоровье методом PluginHelper.GetEntityId ![]() Я так понял, ZooY оттуда код и взял. |
|
![]() |
#6 |
Участник
|
Не совсем оттуда, у меня в коде есть некоторые доработки
![]() |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|