How to add field in existing Table using extension In D365 BC

Add field in existing Table using extension In D365 BC:

Step-01:

  • The table extension object allows you to add additional fields or to change some properties on a table provided by the Dynamics 365 Business Central service. Along with defining other fields, the table extension is where you write trigger code for your additional fields.
  • Mandatory- Extensible Property set to true can be extended.
  • Table Extension Example-
tableextension Id MyExtension extends MyTargetTable
{
fields
{
// Add changes to table fields here
}
var myInt: Integer;
}

Step-02:

  • Open Visual Studio Code  and Select “.vscode” and Add New File as shown in image.
select .vscode

Step-03:

  • Enter the name of the extension as shown in image.
enter name of the extension
  • This table extension object extends the Sales header table object by adding a field LDClause, with ID 50000 and the data type.
  • After doing the above steps. Publish the extension.
tableextension 50012 SalesHeaderExt extends “SalesHeader”
{
fields
{
field(50000; LDClause; Boolean)
{
trigger OnValidate();
begin
if (rec.LDClause = true) then
begin
message(‘LD Clause Valid : %1’, rec.LDClause);
end;
end;
}
}
sales header extension table

Creation Of Table In Microsoft Dynamics 365 BC
Report Creation In Microsoft Dynamics 365 BC
How to Create New Companies in Dynamics 365 Business Central
General Ledger Setup and General Posting Setup– Microsoft

Leave a Reply