Validating Mandatory Fields During Purchase Requisition Workflow Approval in D365F&O
Hi everyone!
I recently worked on a requirement to validate mandatory fields (including a custom field) during the Purchase Requisition workflow approval in Dynamics 365 Finance and Operations (D365F&O).
To achieve this, I worked with the standard class:
This class extends the base and is used as the event handler for Purchase Requisition workflows in D365F&O.
The key point here is that includes a method, which is automatically triggered during the workflow approval process.
To implement the validation logic for mandatory (including custom) fields, I created a Chain of Command (CoC) extension of the method.
Here's the sample code:
With this code, if the Vendor Account field is empty during workflow approval, the system throws a validation error and stops the approval process. You can extend this to validate multiple custom fields based on business rules.
D365FO Product Specialist | Senior Finance & Project Accounting Functional Consultant | Project Manger | Strategic Finance & ERP Consultant | Project Accounting Expert | Digital Transformation Leader
4moDoes the requisitioner always know the vendor in this company that you worked on.? Usually that's finalized by the procurement team.