Design Pattern: Data-driven Blocked Entity

This pattern implements a generic mechanism for dynamically restricting and allowing usage of a record by the business process administrator.

Problem

A Dynamics NAV record can be used in a number of functionalities across the application. There are situations, however, when the administrator wants to restrict the consumption of such a record, as well as lift the restriction when it is no longer relevant.

For example, a new customer record should not be used for posting documents until it is approved by the relevant approver.

We could solve this by using the Blocked Entity pattern, but it requires database schema changes, which have an upgrade impact.

The blocked entity pattern involves:

  1. Adding a “blocked” status field on the record (either a Boolean or in the more advanced cases, an option field refining the usage).
  2. Adding specific code for the record in every place where the restriction needs to be enforced.

In contrast, the Data-driven Blocked Entity pattern involves adding a new record (data change) to mark the restriction, instead of adding a new field (metadata change).

Read more on the NAV Design Patterns wiki site…

Written by Bogdan Andrei Sturzoiu