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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.11.2010, 19:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,626 / 848 (80) +++++++
Регистрация: 28.10.2006
Microsoft Dynamics CRM Team Blog: Custom workflow actions in Microsoft Dynamics CRM 2011 Online
Источник: http://blogs.msdn.com/b/crm/archive/...11-online.aspx
==============

We have received multiple questions and feedback regarding the capability of adding custom workflow activities in CRM 2011 Online and I would like to provide some responses as well as offer some guidance on how to insert custom logic to workflows in CRM 2011 Online.

Due to a technical limitation we are unable to support custom workflow activities in CRM 2011 Online. Custom workflow activities is a widely used feature and having direct support for it in Online is one of our top priorities, we are considering enabling this support in a future release.

Nonetheless, this doesn’t mean that you cannot achieve having custom code that is executed as part of a workflow. There are multiple alternatives that make use of plugins combined with workflows to execute custom code asynchronously similar to custom workflow activities. I will explore one of these patterns in this article by using a real life scenario example.

Scenario: My salespersons constantly call leads to offer our products. If the lead is interested we qualify the lead (convert to account) and add it to a marketing list for prospective buyers. Otherwise we disqualify the lead. We need a call script for the salespersons which seamlessly performs the lead qualification process in the background.

Step 1: Identify which is the logic that is not supported by the CRM Workflow Designer and what inputs/outputs are required.

The only part of my workflow that requires custom code is to add members to the marketing list. Everything else can be handled by configuring a dialog using the CRM workflow designer. For my custom code I don’t need any output but I will need two input parameters: The marketing list and the account which should be added to the list.

Step 2: Create a custom entity to encapsulate the information from step 1.

I will create a custom entity called “Add to marketing list action” hidden from the sitemap. To handle the inputs/outputs it will have two lookup attributes: A marketing list and an account.

Step 3: Define the process in the workflow designer.

I will define the dialog and for the custom action, I will insert a Create step for my custom entity. In the form I will configure the inputs using form assistant:





Step 4: Write the custom code in a plugin

I have my code which I will register in a sandboxed plugin which will trigger on create of “Add To Marketing List Action”.

<div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9D7513F9-C04C-4721-824A-2B34F0212519:ef7d9e5a-f348-4bb9-8cf6-cf6173c892f7" class="wlWriterSmartContent">publicsealedclass AddMemberToMarketingList : IPlugin{publicvoid Execute(IServiceProvider serviceProvider){IPluginExecutionContext context = (IPluginExecutionContext)serviceProvider.GetService(typeof(IPluginExecutionContext)); IOrganizationServiceFactory serviceFactory = (IOrganizationServiceFactory) serviceProvider.GetService(typeof(IOrganizationServiceFactory)); IOrganizationService service = serviceFactory.CreateOrganizationService (context.UserId);Entity customEntity = (Entity)context.InputParameters["Target"]; AddMemberListRequest request =new AddMemberListRequest(); request.EntityId = ((EntityReference)customEntity["new_account"]).Id; request.ListId = ((EntityReference)customEntity["new_marketinglist"]).Id; service.Execute(request); }}
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Теги
crm online, crm2011

 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Ошибка бизнес-процесса Tarasov E Dynamics CRM: Разработка 9 18.02.2010 14:02
CRM DE LA CREME! Configuring Microsoft Dynamics CRM 4.0 for Internet-facing deployment Blog bot Dynamics CRM: Blogs 0 18.08.2009 11:05
Microsoft Dynamics CRM Team Blog: CRM Online: Reporting Options Blog bot Dynamics CRM: Blogs 0 18.06.2009 06:14
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05
Microsoft Dynamics CRM Team Blog: Workflow E-mail Utilities Blog bot Dynamics CRM: Blogs 0 16.12.2008 23:05

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

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

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