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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 07.03.2018, 23:13   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
powerobjects: Using an External Scheduler to Run On Demand Workflows
Источник: https://www.powerobjects.com/2018/03...and-workflows/
==============


Workflows are a valuable tool within Dynamics 365. They are powerful and easy to configure at the same time. When using workflows you may run into scenarios where you need to schedule workflows to run at a certain time or to introduce a wait time between workflow steps.

An example of this would be if we needed to initiate a workflow to notify clients when Contract Renewal Dates become current. If these dates are spread in the future from 1 day to 5 years, you will have to cover all that time by checking frequently when a Renewal Date becomes current (equals today, or one week on the past).

The first thought will be to accomplish this using any of the two OOB available options, adding Process Timeouts to trigger functionality using time or date dependent conditions or using Wait Conditions to trigger the workflow on a field change.

However, both options can be expensive on system resources. In fact, when a timeout is encountered, the workflow unloads from the memory and it is only reloaded when the timeout condition is met. Even so, each waiting workflow is going to have a row in the asynchronous operation table to keep track of it. If your Dynamics 365 ends up with a very large number of records – and as a result waiting workflows, those extra rows do take space and would negatively affect other queries against that table.

Something to remember is that timeouts can only happen up to 24 months out and if the need to restart the server or the asynchronous service arises, all the waiting system jobs possibly being lost. In this case, you will have to restart the workflows again, possibly even manually.

For similar scenarios, a recommended solution is to have an external process to query for Dynamics 365 records once per day and then kick off the workflow at that time for the returned records. The only extra overhead on Dynamics 365 will be one query to find the records.

In our example, we are using the Windows Scheduler to call a console application to execute on demand workflows. This application will initiate a connection with the instance to run a query and to fetch your Dynamics 365 data. This will return all the records that satisfy the conditions and will trigger the workflow to update these records.

1. First download and save the console application from: github.com/OliverFlint/MSCRMWorkflowRunner / and extract sample.xml (renamed config.xml)





2. To define the query criteria, run Advanced Find on your org and export FetchXML.xml. Open it using notepad and copy the code as shown below.



3. Open the config.xml file you extracted on the first step.
  • Paste the code you copied from the FetchXML.xml you generated on the config.xml file. You can clean the code, deleting unneeded attributes.
  • Setup connection with your Org on the config file as shown below using the CRM org URL and system user credentials.
  • Setup the on demand workflow.
  • Save and Close




4. You can test the console application connection settings running the App using command prompt.





5. Next step is to register the application with your Org. Open CRM SDK the URL will be something similar to: C:\CRM2015SDK\SDK\Tools\PluginRegistration





6. Register the application opening PluginRegistration.exe







7. Setup Windows Scheduler. Open windows scheduler and create a new task on the Actions area. Name the task ‘Run Workflow’.





8. Setup task properties defining user or group and to Run whether user is logged on or not.





9. Setup the triggers: Daily and the time.





10. Setup the action, adding the workflow run console application this task to run. Click OK to confirm changes.







To summarize, we created a solution that combines a workflow to update the date, the external app “Workflow runner,” and Windows Scheduler to run this app to:
  • Initiate a connection with the CRM instance,
  • Run a query,
  • Return all the contacts that satisfy the conditions,
  • Trigger the workflow to update only these records.
For more helpful Dynamics 365 tips and tricks, be sure to subscribe to our blog!

Happy Dynamics 365’ing!



Источник: https://www.powerobjects.com/2018/03...and-workflows/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
powerobjects: How to Create an Auto Number Without Code! Blog bot Dynamics CRM: Blogs 0 21.12.2017 21:15
powerobjects: PowerObjects’ Top 10 Most Popular Blog Posts of 2017 Blog bot Dynamics CRM: Blogs 0 15.12.2017 03:21
emeadaxsupport: Connecting Retail Components on an External Computer to the Microsoft Dynamics AX R3 Azure Lifecycle Services Demo Virtual Machine Blog bot DAX Blogs 0 28.06.2014 00:13
Ошибка бизнес-процесса Tarasov E Dynamics CRM: Разработка 9 18.02.2010 14:02
Jim Wang: CRM 4.0 External Connector License Blog bot Dynamics CRM: Blogs 0 11.02.2009 06:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 05:40.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.