tableextension 50100 "CustomerMpesaExt" extends Customer
{
fields
{
field(50100; "M-Pesa Mobile Number"; Text[20])
{
Caption = 'M-Pesa Mobile Number';
DataClassification = CustomerContent;
trigger OnValidate()
var
Regex: Codeunit Regex;
begin
if "M-Pesa Mobile Number" <> '' then begin
"M-Pesa Mobile Number" := DelChr("M-Pesa Mobile Number", '=', ' -+');
if not Regex.IsMatch("M-Pesa Mobile Number", '^254[0-9]{9}$') then
Error('Invalid Kenyan phone number format.');
end;
end;
}
}
}
Non-Intrusive Customizations in Business Central using Table Extensions
In Microsoft Dynamics 365 Business Central, modifying base source code directly is disallowed. The AL Language utilizes tableextension objects to introduce custom fields, keys, and validation triggers seamlessly.
Accelerate Your Engineering Career
Get monthly masterclasses, exclusive code snippets, and direct architectural reviews.
Become a Supporter • KES 500 / Month