I have done some customization in Dynamics AX vers. 2.5!

The procedure is like this:

  1. User create Sales Order with certain customer and product ID's.
  2. User create an invoice when Sales Oder is fully created (booking Sales Order)
  3. When specific criteria is met, regarding to customer type and/or product type, a script create another Sales Order, with certain product ID's and customer. But that Sales Order isn't automatically booked like the previous Sales Order that user created manually. 

I want the second Sales Order to be booked automatically when user book the manual Sales Order, to the procedure should be when user book Sales Order that he created manually, the second Sales Order is created and also booked and invoice is printed out in the same way that manual Sales Order is booked and printed out.

It's more convenient to automatically book the second Sales Order in the same action when user book the first Sales Order and print invoice made from it, instead the user have to look into the Sales Order list, find the Sales Order that have been automatically created when manual Sales Order was booked and user have to manual book the second Sales Order.

What class do I need to use to take advanced of this feature? I have code that create Sales Order automatically but I need to book it automatically too when user book the Sales Order that he have manual created before.