Data clean up
When a new complaint record is created, it will be inserted into the Complaint Header table. When the lines are added, it will be inserted into the Complaint Line table. When comments are added, it will add it to the Complaint Comment table.
All is fine and dandy when we're adding, but what about when the records are deleted? If a user goes in and deletes a Complaint Header record from the Product Complaints page, how will Dynamics NAV know to delete the associated Complaint Line and Complaint Comment records?
The answer unfortunately is not magic (although sometimes I wish it would be); it's done through C/AL programming on the Complaint Header table. Like a good student, you would've gone to the Sales Header table and looked at the OnDelete
trigger to draw inspiration.
Let's put the clean-up code into our Complaint Header table. Go to Table 50000 and bring up the Table Designer screen. The first thing we need to do is to declare the C/AL Globals for the Complaint Line and Complaint...