Hi everyone,
Recently, I encountered a requirement to create a journal entry against a vendor. However, there’s an important condition: if the vendor has a matching policy enabled, the system should restrict creating a ledger journal for that vendor.
To handle this, I implemented a validation that triggers whenever a Vendor ID is selected at the journal line level. This check ensures that if the vendor has a matching policy, the system will block the action and notify the user accordingly.
In this post, I’ll Walk you through:
-
How I implemented the vendor validation logic
-
How default and offset dimension validation works
The SegmentedEntryControl is used to input ledger accounts and financial dimension combinations. To enforce custom validation logic, follow these steps:
-
Create a CoC Extension for
SegmentedEntryControl: Use the Chain of Command to extend theSegmentedEntryControlclass. -
Override the validate (
)Method: Within your extension, override the validate ()method to include your custom validation logic. -
Implement Vendor Matching Policy Check: In your overridden method, retrieve the selected Vendor ID and check if the vendor has a matching policy enabled. If so, prevent the creation of a ledger journal.
The validate() method in the SegmentedEntryControl class can be overridden using Chain of Command (CoC) to apply custom validation logic to both the Ledger Dimension and Offset Dimension fields in Dynamics 365 Finance and Operations. This approach ensures that your validation logic is consistently applied across different segmented entry controls.