Tuesday, 16 January 2018

How to check custom validation on purchase order confirmation event in AX7 / D365

There are scenarios where we need to do some custom validations on the purchase order while we try to confirm the PO.
In AX7 / D365 we can use the pre-post events in order to achieve our goal.

For the purpose of validation on purchase order confirmation we use the following event :






The reason of using post event handler of method "validate" of class PurchFormLetter_PurchOrder is that the system runs its default validations first and then we check for our custom validations.

The "validate" method of class PurchFormLetter_PurchOrder is generic, so we first need to capture if the flow of the code occurs from the confirmation class of the purchase order:








Now we do our validations in this "if " check and we need to stop the confirmation of PO in case of failure of our custom validations:











and in case of successful custom validations :


3 comments:

  1. Informative blog. Keep it up (Y)

    ReplyDelete
  2. I am impressed. I don't think Ive met anyone who knows as much about this subject as you do. You are truly well informed and very intelligent. You wrote something that people could understand and made the subject intriguing for everyone. Really, great blog you have got here. 소액결제 현금화

    ReplyDelete

How to block inventory in ax D365 / AX7

In Dynamics AX if we want to block inventory for certain item, we have an out of the box form which caters this need and blocks the inventor...