Choose your path Increase your proficiency with the Dynamics 365 applications that you already use and learn more about the apps that interest you. Up your game with a learning path tailored to today's Dynamics 365 masterminds and designed to prepare you for industry-recognized Microsoft certifications.
Visit Microsoft Learn
2020 release wave 1 Discover the latest updates and new features to Dynamics 365 planned through September 2020
Release overview guides and videos Release Plan | Preview 2020 Release Wave 1 Timeline
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 TechTalks | Customer Engagement TechTalks | Upcoming TechTalks
I would like to implement some functionality in a form (form pattern = "Details Transaction") when the user leaves the header datasource (e.g. "write the record to the DB"). In the first place the method "leave" of the header datasource seems to be the suitable solution. After some "Debugging" and "infologging" I found out that the event sequence is not as I would have expected. If you change a value in a field in the header datasource and afterwards directly click into a "not selected" line in the line view grid the event sequence is like the following:
I need a realiable point where I can save the record if the user leaves the focus on the header datasource (in the sequence above I would have the position 3 be done before position 1 & 2).
Here is an example screenshot showing the "user click order":
Any hint is appreciated.
Could you share the business / functional requirement? That would definetely help us to provide good suggestions.
Here is the requirenment: if the users changes some information in the header the values should automatically be updated in the corresponding lines and connected other records.
In the above mentioned situation this leads to the conflict that the user can edit a line, which should have been updated before via the auto update from header to line.
Even though the events that you describe might seem a bit out of sequence, they do happen all at once. So you should not need to care about update conflict much. It's definetely not possible that your user would write to the SalesLine record before the SalesTable record is written.
In my opinion you should hook in the update method of the SalesTable. When SalesTable.update is executed, and value of your field in the _orig. buffer is different than in the current buffer,, update all SalesLines with the value from your field.
Another option where to put your code is Classes\SalesTableType\modifiedField. But if you hook to modifiedField, the code works only when the field is modified on a form. But it will not kick in for other processes, such as data import via Excel.
If needed, refresh() and research(true) the salesLine data source after the onWritten event of the SalesTable data source.
Thank you for the detailed Explanation. I think this is the best solution in my case. I will follow your suggestion.
Business Applications communities