New resources available on Microsoft Learn
Did you know that Microsoft Learn offers free training modules to assist you on your path to mastering Dynamics 365 for Finance and Operations? Become an expert at your own pace or share with your team to foster growth.
Dynamics 365 2019 release wave 2 plan Discover the latest updates to Dynamics 365.Release Plan | Weekly Deployment Notes
Ace your Dynamics 365 deployment with packaged services delivered by expert consultants.Explore service offerings
Connect with the ISV success team on the latest roadmap, developer tool for AppSource certification, and ISV community engagements.
ISV self-service portal
The FastTrack program is designed to help you accelerate your Dynamics 365 deployment with confidence.
FastTrack Program | Finance and Operations TechTalks | Customer Engagement TechTalks | Talent TechTalks
Want to compare two fields of a table and throw validation message if first date field is greater than the second date field. Where and what will be the code to do so.
I have written this code on form level but its not working.
What exactly do you mean by "its not working"?
We can't help you if you don't tell us what problem you're dealing with.
Your code has two problems:
1) In the event handler you declare salesTable but don't assign any value to it. So it's comparing the field values within an empty table buffer (where both dates are obviously empty).
2) You are adding event handler methods to an augmentation class (extensionOf). You should separate class augmentation and event handlers in two separate classes. https://daxmusings.codecrib.com/2018/06/accidental-code-extensions.html
I also recommend putting your code in the validateWrite method / event of the table. Otherwise it will only work on this form but anyone entering data via some other channel (such as Excel) will pass this validation.
Your salestable buffer is empty , you have to get it from sender . See below .
FormDataSource inventTransferLine_ds = sender.datasource();
Business Applications communities