
Hi experts,
I need to fire some code when user create SalesLine for a salesOrder.
So where should I write the code , what would be the correct place to put my code.
Thanks.
*This post is locked for comments
I have the same question (0)It depends on the code which you intend to run. If it is supposed to execute whenever a SalesLine record is inserted even when it is from other sources such as AIF or a custmer portal sales basket, then you'd have to override the insert() method on SalesLine table. Write your own logic in a new method that you create, and call that method from insert(). A better option would be to use a post-eventhandler subscription for the insert method, so it would be easier to upgrade for future versions. Also please note that in Standard AX they added a class maintaining operations with the sales objects and you might place your logic in there as well, take a look at the SalesLineType class.
If you only want to fire your logic on the SalesTable form only when raising the order through the AX user interface, then you'd override the SalesLine formdatasource's write() method.