Implementing cascading in business central for custom tables

37 views Asked by At

I hope you are all doing well. I have a query regarding implementing cascading for custom tables.

In D365 Business Central, when a user changes the Customer No. in the Customer Master, BC automatically propagates the updated customer number throughout the system.

I have a custom master table that I'm using in several custom tables. If I update the value of the primary key/field in the custom master table, I want BC to update its value wherever this field is being used. Is this possible using pure AL Language? If yes, could you please provide me with some reference links or workarounds?

Your answers will be highly appreciated. Thanks for reading.

1

There are 1 answers

0
kaspermoerch On

The key property in this case is the TableRelation property:

field(50000; "Customer No."; Code[20])
{
    TableRelation = Customer."No.";
}

This field would be updated with the new value if the customer was renamed i.e. a new value was assigned to the No. field on a record in the Customer table.

One thing to note that even though this looks like a foreign key on SQL level it is not maintained as that. It is handled solely by the platform meaning that if you many fields on many records it can be a rather time consuming process for the platform to handle the update.