You would program this condition in the OnDelete trigger of the table. Mind you, that only works when someone is manually deleting records, and when DELETE is called from C/AL code with parameter TRUE. When DELETE is called with FALSE, it does not execute logic in the OnDelete trigger, so in that case you need to also add the condition to whatever process is deleting the record.
You can also do this on the OnGlobalDelete function in Codeunit 1. Put an error statement in there and log deletes (in the Change Log Setup) for whatever table to you want to control.
"Certain conditions" usually apply to individual tables. I would always program conditions like that in those tables themselves. If you program codeunit 1 to handle exceptions for specific tables, you would always have to move individual tables with codeunit 1 when you do object maintenance. What kind of issues would come with that if you are in the middle of development for 35 tables, and only 2 of them are tested and approved? You would have to wait until development for all the other ones is done to move stuff out to production. That's asking for object conflicts in my opinion.
It's very smart thing to do for global conditions though, I can definately see there's a lot of potential in that approach. Just not for conditions specific for individual tables.
Just a bit off topic - what percentage of customer's would you say get the change log granule?
We for one don't.. Is this a sql thing or available in native too.
Which version did it appear in?
Comments
RIS Plus, LLC
MVP - Business Apps
Of course, this requires the change log granule.
It's very smart thing to do for global conditions though, I can definately see there's a lot of potential in that approach. Just not for conditions specific for individual tables.
RIS Plus, LLC
MVP - Business Apps
We for one don't.. Is this a sql thing or available in native too.
Which version did it appear in?
Sorry for the tangent & thanks.
http://www.BiloBeauty.com
http://www.autismspeaks.org