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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 03.08.2021, 23:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
a33ik: Creating new D365FO Business Event
Источник: http://daxonline.org/1724-creating-n...ess-event.html
==============

New business event for Customers.
Main contract class:


/// /// This is a BusinessEventContract class for Customer/// [DataContract]class VKCustTableBusinessEventContract extends BusinessEventsContract{ SysAppCRUDOperation action; CustAccount custAccount; DataAreaId dataAreaId; private void initialize(CustTable _custTable, SysAppCRUDOperation _action) { custAccount = _custTable.AccountNum; dataAreaId = _custTable.DataAreaId; action = _action; } /// /// Create new VKCustTableBusinessEventContract from CustTable and action /// /// CustTable table /// Action /// a new VKCustTableBusinessEventContract public static VKCustTableBusinessEventContract newFromCustTable(CustTable _custTable, SysAppCRUDOperation _action) { VKCustTableBusinessEventContract contract = new VKCustTableBusinessEventContract(); contract.initialize(_custTable, _action); return contract; } protected void new() { } [DataMember('CustAccount'), BusinessEventsDatamember("CustAccount")] public CustAccount parmCustAccount(CustAccount _custAccount = custAccount) { custAccount = _custAccount; return custAccount; } [DataMember('Action'), BusinessEventsDatamember("Action")] public SysAppCRUDOperation parmAction(SysAppCRUDOperation _action = action) { action = _action; return action; } [DataMember('DataAreaId'), BusinessEventsDatamember("DataAreaId")] public DataAreaId parmDataAreaId(DataAreaId _dataAreaId = dataAreaId) { dataAreaId = _dataAreaId; return dataAreaId; }}Business event class:


/// /// This is a BusinessEvent class for Customer/// [BusinessEvents(classStr(VKCustTableBusinessEventContract), "Customers CU", "Event for create, update", ModuleAxapta::General)]class VKCustTableBusinessEvent extends BusinessEventsBase{ private CustTable custTable; SysAppCRUDOperation action; /// /// Create new VKCustTableBusinessEvent from CustTable and action /// /// CustTable table /// Action /// a new VKCustTableBusinessEvent public static VKCustTableBusinessEvent newFromCustTable(CustTable _custTable, SysAppCRUDOperation _action) { VKCustTableBusinessEvent businessEvent = new VKCustTableBusinessEvent(); businessEvent.parmAction(_action); businessEvent.parmCustTable(_custTable); return businessEvent; } private CustTable parmCustTable(CustTable _custTable = custTable) { custTable = _custTable; return custTable; } private SysAppCRUDOperation parmAction(SysAppCRUDOperation _action = action) { action = _action; return action; } protected void new() { } [Wrappable(true), Replaceable(true)] public BusinessEventsContract buildContract() { return VKCustTableBusinessEventContract::newFromCustTable(custTable, action); }}Extension to CustTable table to trigger insert/update events:


/// /// Extension class for Custtable table/// [ExtensionOf(tableStr(CustTable))]final class VKCustTable_Extension{ public void insert(DirPartyType _partyType, Name _name,boolean _updateCRM) { next insert(_partyType, _name, _updateCRM); if (BusinessEventsConfigurationReader::isBusinessEventEnabled(classStr(VKCustTableBusinessEvent)) && !CustTable::vkSkipByUserFilter()) { VKCustTableBusinessEvent::newFromCustTable(this, SysAppCRUDOperation::Create).send(); } } public void update(boolean _updateSmmBusRelTable, boolean _updateParty) { next update(_updateSmmBusRelTable, _updateParty); if (BusinessEventsConfigurationReader::isBusinessEventEnabled(classStr(VKCustTableBusinessEvent)) && !CustTable::vkSkipByUserFilter()) { VKCustTableBusinessEvent::newFromCustTable(this, SysAppCRUDOperation::Update).send(); } } /// /// Whether to skip sending business event or not /// /// true to skip sending BE public static boolean vkSkipByUserFilter() { boolean ret = false; // Use there real user id, which will be used for integration to avoid triggering update business event when external system updates the entity if ('Admin' == curUserId()) { ret = true; } return ret; }}
Configuration:


- Build
- System administration / Setup / Business events / Business events catalogue
- Manage / Rebuild business event catalogue
You should be able to find your Business Event in the list in specified category (General from example above)



Power Automate:


- Create new
- Automated cloud flow
- Set Flow name and click Skip button
- In Search input type "Dynamics"
- Select Fin & Ops Apps
- Select Whan a Business Event occurs
- Select three dots in the right top corner and in My connecions section select "Add new connection"
- Select Connect with service principal
- Fill in Connection name, Client ID, Client Secret and Tenant (which is Licensed to in D365FO About)
- Select three dots in the right top cornerand choose corrrect connection
- Select right Instance
- Select General as Category
- Select Customer CU as Business event


- Add new step
- Type "Parse JSON" in search input
- Select "Parse JSON"
- Set body of previouse step as a Content
- Click Generate from sample button and pase there Schema from Business event (System administration / Setup / Business events / Business events catalogue / find the record / click Download schema button)


- Add additional steps with required actions
Troubleshooting:

There is a bug in Power Automate that it is not possible to select your business event if you place it in a category with existing standard business events, for example "Accounts Receivable". It shows duplicating record in the category dropdown and then there is no option to select your newly created business event:
Category dropdown:







Источник: http://daxonline.org/1724-creating-n...ess-event.html
Старый 06.08.2021, 08:42   #2  
trud is offline
trud
Участник
Лучший по профессии 2017
 
1,038 / 1629 (57) ++++++++
Регистрация: 07.06.2003
Записей в блоге: 1
А кто-нибудь знает кто ведет этот сайт? Качество и кол-во материала просто огромное. Странно что все анонимно
Старый 06.08.2021, 14:06   #3  
fed is offline
fed
Moderator
Аватар для fed
Ex AND Project
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
2,892 / 5650 (194) ++++++++++
Регистрация: 13.03.2002
Адрес: Hüfingen,DE
Цитата:
Сообщение от trud Посмотреть сообщение
А кто-нибудь знает кто ведет этот сайт? Качество и кол-во материала просто огромное. Странно что все анонимно
Там в правом верхнем углу каждого оригинального поста есть имя и фамилия автора. (И я по крайней мере двух разных авторов там видел).
Старый 06.08.2021, 14:19   #4  
fed is offline
fed
Moderator
Аватар для fed
Ex AND Project
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
2,892 / 5650 (194) ++++++++++
Регистрация: 13.03.2002
Адрес: Hüfingen,DE
Меня вот больше интересует, почему этот блог импортируется под алиасом a33ik, который вообще-то и на axforum и на микрософтовских сайтах к MVP по CRM прикреплен.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
sertandev: How to integrate D365FO with Microsoft Flow using the new Business Events Blog bot DAX Blogs 0 23.05.2019 16:11
everythingdynamicsaxbi: How to: Successfully enable Business Events in D365FO Blog bot DAX Blogs 0 19.03.2019 23:13
alexef: How to add a field to Item Card in Business Central Blog bot NAV: Blogs 0 22.05.2018 20:11
atinkerersnotebook: Creating Lifecycle Services Business Process Models Blog bot DAX Blogs 0 09.04.2014 15:11
atinkerersnotebook: Walkthrough & Tutorial Summary Blog bot DAX Blogs 1 09.09.2013 09:11
Опции темы Поиск в этой теме
Поиск в этой теме:

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

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

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

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