Wednesday, 27 November 2013

AX2012 R2: Adding generic custom validations when posting sales orders

Hi Friends,
It is good to keep this information handy so I posted on the blog.
If we need to add our own custom validation for salesTable/Customer record when performing posting on sales orders, then the best place to write the logic is \Classes\SalesFormletterProvider\checkHeading().
This function is called to check some generic rules  for salesTable or Customer during any type of posting (Confirmation/Picking/Packing/Invoicing) process of sales order.

See below the way  standard AX does it.

You can create a method on salesTable which returns a boolean value and call it along with other standard AX validations.
You can check the posting type by using the function this.parmDocumentStatus() so that if you want to run  validation only for specific posting type you can run it.
Note this approach should only be taken when you have to add some generic validations applicable on all types of posting.

Thanks for reading the blog.

No comments:

Post a Comment