It’s been a long time since I blog my last post, this time, I came up with Sales and Purchase posting using FormletterService Class. This framework has been refactored/restructured/changed in Microsoft Dynamics AX 2012 to provide better support for customizations, extensibility, and performance. It is a vital concept for developers to know before they want to customize any of the below document processes while posting
- If it is Sales Posting then below are sub processes (documents).
- Picking List
- Packing Slip
- If it is Purchase Posting then below are sub processes (documents).
- Receipt List
- Packing Slip
The sub processes of both Sales Posting and Purchase Posting have been accomplished using FormLetterService Class.
The run method posts documents. The following code roughly shows the pattern used in the run method in the service.
The class has a service operation method for each of the document types that can be posted by this service such as postSalesOrderConfirmation() method in our case as shown below.
Here, I will try to explain using Sales confirmation scenario. so, let’s starts.
When the user clicks on Sales Order Confirmation menu item results into SalesFormLetter Class->main Method.
When any posting happens, it must go through following steps.
Create Parm data which populates on SalesEditLines Form in our case which accomplished using SalesFormLetterParmDataConfirm extended by SalesFormLetterParmData which is extended by FormLetterParmData Class extended by FormLetterServiceController class create data in SalesParmTable, SalesParmSubTable, and SalesParmLine Tables.
When you press OK button in SalesEditLines Form, it takes you to postSalesOrderConfirmation method of FormLetterService Class. run method FormLetterService Class takes you to SalesConfirmJournalCreate Class extended by FormLetterJournalCreate Class creating Journal data in CustConfirmJour, CustConfirmTrans and CustConfrimSalesLink Tables.
Once it created Journal data, it proceeds for Journal posting. the run method of FormLetterService class takes you to SalesCofirmJournalPost class extended by FormLetterJournalPost Class updating Journal data in CustConfirmJour, CustConfirmTrans, MarkUpTrans, InventTransOrigin Tables. The FormletterJournalPost class hierarchy can be used to post one journal, for example, updating ledger and inventory.
Once it is posted, it proceeds for journal printing. This is accomplished using SalesConfrimJournalPrint extended by FormLetterJournalPrint class. The FormletterJournalPrint class hierarchy can be used to control the printing of one or more journal documents.
The following table shows where customization should be moved to the Microsoft Dynamics AX 2012 Form Letter framework.
This set of classes had a number of functions, including the following:
1) Interaction with the posting form, such as SalesEditLines.
2) Creation and maintenance of posting data, such as records in SalesParmTable.
3) Creation of journal data, such as records in CustConfirmJour/CustConfirmTrans.
5) Updating sub ledgers, such as ledger and inventory.
6) Controlling document outputs, such as printing and XML export.
7) Client/server marshaling.
Hope you like my post.
Till then, Happy DaXing.