Master Data Sync in Business Central lets you keep records synchronised between a master company and one or more subscriber companies. One useful feature is the ability to automatically delete records in the subscriber company when they no longer match the filter you have set up on a template. This article explains how to enable that behaviour and what to expect when you use it.
You control this through the Delete records outside filter setting on the relevant template. When you enable it, any record that falls outside the template filter will trigger a delete message to your subscribers, removing the record from the subscriber company.
If a record cannot be deleted in the subscriber company because it has transactions or dependencies, Master Data Sync gives you a clear error message explaining the cause instead of failing silently.
Setting up the delete filter on a template
The starting point is a template with a filter on it. In this example, the item template is filtered so that the type must be Inventory and the inventory posting group must be Finished.
To enable automatic deletion, open the template and find the setting Delete records outside filter. When this is checked, any record that no longer matches the filter will be sent as a delete message to the subscriber.
How a record falls outside the filter
Consider an item that has already been sent to the subscriber company but has no transactions on it yet. In this case it is a “Super Light Front Wheel” item.
By mistake, the item was set up with the inventory posting group Finished, when it should have been a different group. Once you correct the inventory posting group on the item, it no longer matches the template filter.
Because the item now falls outside the filter, the system flags that item 1002 should have a delete message sent to the subscribers.
Sending the change to the subscriber
You can review what is about to happen before you send anything. By personalising the relevant page and adding the right fields, you can see which records are queued and what action they will trigger, so you know that a delete is about to be sent rather than a normal update.
When you are ready, send the file to your subscriber as you would for any other synchronisation.
What happens in the subscriber company
In the subscriber company, the item is still present until you run the synchronisation. At that point you can see that there is one record action that has not yet been executed, and that the action type is a delete.
When you run the synchronisation from the subscriber side, go to actions and run the master record actions. The delete action for the item executes, and if everything goes well it completes without any error text. Looking at the items afterwards, item 1002 has been deleted from the subscriber company.
What happens when a record cannot be deleted
If the item has transactions or other dependencies in the subscriber company, the delete cannot complete. In that case the record action returns an error message that tells you exactly what the cause is, so you can decide how to handle it. This keeps you in control rather than leaving records out of sync without explanation.
Q&A
How do I make Master Data Sync delete records in the subscriber company?
Enable the Delete records outside filter setting on the template. When a record no longer matches the template filter, the system sends a delete message to the subscriber, which removes the record there once you run the synchronisation.
What triggers a delete message to the subscriber?
A delete is triggered when a record that was previously synchronised no longer matches the template filter. For example, if you change an item’s inventory posting group so it no longer fits the filter, that item is queued for deletion in the subscriber company.
Can I see that a delete is about to be sent before I send it?
Yes. By personalising the page and adding the relevant fields, you can see which records are queued and that the action is a delete rather than an update.
What happens if a record cannot be deleted in the subscriber company?
If the record has transactions or dependencies, the delete cannot complete. The record action returns an error message that explains the cause, so you know why it failed.
