![]() |
#1 |
Участник
|
stoneridgesoftware: Using the new Chain of Command feature in X++
Источник: https://stoneridgesoftware.com/using...-feature-in-x/
============== Recently a new feature for X++ developers was announced from Michael Fruergaard Pontoppidan (MFP) called Chain of Command. I knew I would want to try it out as soon as I had some time and it is pretty slick. This post will show it in action with a simple example in Microsoft Dynamics 365 Enterprise edition (AX7). Syntax Requirements My example is nothing flashy. It shows how to raise an Infolog message when a sales line is added to a sales order and the customer does not have a credit rating. Since I know that when you add a sales line, the SalesLineType class is called and the insert method is used. My plan was to create an extension for the SalesLineType class and put custom code in the insert method. Here is the code for the new extension class: X++: [ExtensionOf(classStr(SalesLineType))] final class SalesLineType_Extension { public void insert(boolean dropInvent, boolean findMarkup, Common childBuffer, boolean _skipCreditLimitCheck) { CustTable custTable; //get customer for evalation of credit rating custTable = CustTable::find(salesLine.CustAccount); if(!custTable.CreditRating) { info("Customer on sales line has no credit rating!"); } // must call next when using Chain of Command pattern next insert(dropInvent, findMarkup, childBuffer, _skipCreditLimitCheck); } } For reference, here is my project which is based on a new package in Visual Studio: ![]() Here is the Infolog when saving a new sales line: ![]() Debugging Tip One issue I ran into was around debugging with Visual Studio. The symbols would not load for my breakpoints. To resolve this, I marked the below setting in the Visual Studio debugging options. In addition to this one, there is also a similar setting in the Dynamics 365 node. ![]() Chain of Command was released with Platform Update 9. You can find more information in this “What’s New or Changed in Dynamics 365 for Finance and Operations” article. Источник: https://stoneridgesoftware.com/using...-feature-in-x/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. Последний раз редактировалось mazzy; 29.09.2017 в 10:49. |
|
Теги |
chain of command |
|
|