Показать сообщение отдельно
Старый 23.09.2012, 06:33   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
Microsoft Dynamics CRM Team Blog: How to Execute a Workflow from a Ribbon Button and Control when the Button is Enabled
Источник: http://blogs.msdn.com/b/crm/archive/...s-enabled.aspx
==============

I just published a new technical article for developers titled Asynchronous Ribbon Enable Rules and Executing Workflows from the Ribbon with Microsoft Dynamics CRM 2011 and Microsoft Dynamics CRM Online.

This article describes the scenario where a ribbon control, in this case a button, can be used to execute a workflow. That by itself is not terribly difficult. There is a message called ExecuteWorkflowRequest that you can use with JavaScript and the SOAP endpoint for web resources.

However when looking at the scenarios where you might want to do this, we found that the more challenging task is controlling when the button to execute the workflow should be enabled. Especially for an action like a workflow that is executed asynchronously. You don’t want to have a UI where someone can repeatedly click a control and generate multiple workflow instances to execute. To get information about whether to enable the button or not you generally have to query data to determine if the conditions are right.

Furthermore, EnableRules for the ribbon cannot depend on (relatively) long running processes such as those to retrieve data. A long running process for an enable rule will affect the person’s experience using the ribbon controls so it is important to minimize the impact of these types of rules. The strategy described in this article is to use asynchronous requests for data and then refreshing the ribbon when the data is returned. The SDK topic Define Ribbon Enable Rules mentions this strategy in regard to custom rules, but this article provides a specific example.

I hope that this article will help you if your requirements are to execute a workflow from a ribbon control.

Cheers,

Jim Daly




Источник: http://blogs.msdn.com/b/crm/archive/...s-enabled.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.