Sales and Purchase posting using FormLetterService Class using an example in AX 2012.

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

  1. If it is Sales Posting then below are sub processes (documents).
    • Confirmation
    • Picking List
    • Packing Slip
    • Invoice
  2. If it is Purchase Posting then below are sub processes (documents).
    • Confirmation
    • Receipt List
    • Packing Slip
    • Invoice

The sub processes of both Sales Posting and Purchase Posting have been accomplished using FormLetterService Class.

FormLetterService

The run method posts documents. The following code roughly shows the pattern used in the run method in the service.run_method

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.

postSalesOrderConfirmation.png

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.1

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.

2

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.
4) Validations.
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.

Advertisements

3 responses

  1. Very informative post. Will it be possible for you to post the same for Sales Quotation and Free-Text invoice posting?

    Like

    1. Sure, my next focus will on same and Inventory posting as well. Than you.

      Like

  2. Raziq very well written and informative article. Keep writing.

    Liked by 1 person

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: