Customer-Specific Item Warning + Recommended Substitute

A Business Central AL extension that shows a warning when a user adds a specific item for a specific customer on a Sales Order line, and suggests a substitute item (warning-only, not a hard block).

Business CentralALSales OrdersRules Engine

Summary

Problem
Customer-specific part requirements lived as tribal knowledge. This increased the chance of wrong-item entry on Sales Orders and created rework when substitutions were needed.
Solution
Built a warning-only rules engine in Business Central. When a Sales Line item is entered, the extension checks for a matching customer+item rule and shows a warning with an optional recommended substitute item.
Result
Standardized guidance directly in the Sales Order workflow while still allowing users to proceed when exceptions are valid (ex: out of stock).

Business Impact

Fewer wrong items
Guidance appears at the exact moment of entry, reducing avoidable customer-specific mistakes.
Less rework
Reduces order edits, returns, and follow-up messages caused by wrong part selection.
Maintainable rules
Rules are managed on a BC admin page (enabled toggle + message) without changing code each time.

Gallery

Screenshots and artifacts from the build (sanitized where needed).

1) Create a rules table + admin page

I created a custom table to store rules (customer + not recommended item + recommended item + warning message + enabled), and a list page so rules can be maintained directly inside Business Central.

2) Event subscriber (Sales Line)

An event subscriber runs when an item is entered on a Sales Order line. It checks for a matching rule and shows a warning popup. This is warning-only—users can still proceed when exceptions are needed.

3) Package + publish

Packaged the extension into an .app and published it successfully. I verified deployment by searching for “Customer Item Rules” in Business Central and confirming the new page appeared in Administration.

4) Validate behavior

Created a sample rule record (Enabled = true), then tested on a Sales Order for the target customer. When the restricted item was added, the warning popup displayed the configured message and substitute item number.

AL objects created
  • CustomerItemRule.Table.al — stores rules (customer, item, recommended item, message, enabled, optional dates)
  • CustomerItemRules.Page.al — list page to maintain rules
  • CustomerItemRuleSubscriber.Codeunit.al — subscriber checks rule and shows warning
  • CustomerItemRules.PermissionSet.al — permissions for maintaining rules