Bojensen Blogs

Posting SalesOrder Confirmation with SalesFormLetter Class in Ax

The Book of orders in Microsoft Dynamics AX is done through the class “sales form letter” or one of its more concrete (derived) classes.

Each reservation type (eg confirmation, delivery note, invoice) is represented by a class that is derived from the base class “sales form letter” (see illustration).

To reserve an order by code, an object of class “sales form letter” can be created.

salesFormLetter = SalesFormLetter::construct(DocumentStatus::Confirmation);

This is done as common practice in Microsoft Dynamics AX, on the “construct” method of the class. must be specified as parameters to this method the desired type of booking (eg confirmation, delivery note, invoice).

The “construct” a method generates the appropriate transaction type, object and returns that (in this case, a “SalesFormLetter_Confirm” object created).

The actual book is called the method “update”. Since this method can all be submitted for the booking necessary data as parameters, is a single assignment of such a mandate which is to be posted not necessary.

For example:

// — — Book without print

 

This example is good to see that necessary for the posting of a job essentially only two steps.

  1. On the method “construct” the company produce a type PCX object.
  2. By calling the method “update” to book the order.

Of course, even more extensive or more specialized booking scenarios with the class are ready to buy “sales form letter.” For example it is possible to print the same booking with these documents (once, several times and in different formats), open to the mask for the booking (for the user to influence within the company) or the booking is not directly run, but this provide for batch processing.

Thus, it is not too complex, just one more example of booking and simultaneously print the appropriate documents.

// — — Book with print

Comments are closed.