AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 17.05.2011, 21:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
Danny Varghese: Plug-In When Case (Incident) Is Closed
Источник: http://varghesedanny.com/2011/02/24/...ent-is-closed/
==============

Business Case:

I have a client where we leveraged the case (incident) entity for a problem resolution process.  The case moves through stages throughout an approval process whereby multiple people within the organization may handle the case.  Once the case is resolved, the case stage needs to be set  to resolved.

Proposed Solution:

What I needed to do here was update the stage before the case was resolved.  Since resolving the case involves using the menu, there wasn’t any way to intercept the message before the case was actually resolved.   I couldn’t use a workflow because I needed to make an update to the case before it was actually resolved.  Since workflows run asynchronously, that wouldn’t work.  I finally settled on using a plug-in, firing on the pre-event processing stage of the entity.

Issue:

I couldn’t figure out for the life of me what message gets sent with the plug-in execution context.  Through trial and error, I finally figured out when a case is resolved, the “CLOSE” message gets sent to the context.  Next, I ran into an issue where I perform a pretty standard check within my plug-in code:

if ((context.InputParameters.Contains(ParameterName.Target)) && (context.InputParameters[ParameterName.Target] is DynamicEntity))

The above statement checks if the context’s input parameters contains a “target” dynamic entity.  However, for a case the context sends an input parameter with the name = “IncidentResolution” and that is a dynamic entity.  So the code would look like the following:

if ((context.InputParameters.Contains(“IncidentResolution”)) && (context.InputParameters["IncidentResolution"] is DynamicEntity))

The last thing I did was register the plug-in as a PRE-close event, so that it gets fired before the resolution of the case gets committed to the database.  I then retrieve the incident id from the incident resolution entity, and update the record’s stage value.

This took me a few hours of trial and error, so hopefully this will save some time for someone, happy coding!




Источник: http://varghesedanny.com/2011/02/24/...ent-is-closed/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
ukcrm: Closing An Incident (Case) That Has Open Activities Blog bot Dynamics CRM: Blogs 0 04.07.2009 04:16
Транслитерация русских букв в английские Poleax DAX: Программирование 2 03.07.2009 17:59
Сумма прописью в отчетах SLK Dynamics CRM: Разработка 7 20.03.2009 00:48
mscrm4ever: CRM 4.0 Concatenating Fields Plug-In Blog bot Dynamics CRM: Blogs 0 14.02.2009 14:05
Microsoft Dynamics CRM Team Blog: Microsoft Dynamics CRM Plug-in Template for Visual Studio Blog bot Dynamics CRM: Blogs 0 27.10.2008 23:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 03:14.