Wednesday, November 28, 2018

What is a Table Extension in Dynamics 365 Business central?

What is a Table Extension?

The Table Extension object is used to extend existing tables in the Microsoft Dynamics 365 Business Central application. 

We can add new fields, but not delete or change existing fields. There are certain table properties that cannot be modified 

with a Table Extension (like for example the ID and Name of table). We can create new secondary keys, but cannot 

modify the primary key. 

Creating a table extension works the same way as creating a table.
tableextension 70000020 SocialMediaChannel extends Customer
{
fields
{
field(70000100;Facebook;Text[50])
{
ExtendedDataType=URL;
}
field(70000101;Twitter;Text[50])
{
ExtendedDataType=URL;
}
field(70000102;Instagram;Text[50])
{
ExtendedDataType=URL;
}
field(70000103;Skype;Text[50])
{

}
}
}

Overview

The Table Extension object is used to extend existing tables in the Microsoft Dynamics 365 Business Central application. We can add new fields, but not delete or change existing fields. There are certain table properties that cannot be modified with a Table Extension (like for example the ID and Name of table).  We can create new secondary keys, but cannot modify the primary key.

Example

Creating a table extension works the same way as creating a table.
tableextension 70000020 SocialMediaChannel extends Customer
{
fields
{
field(70000100;Facebook;Text[50])
{
ExtendedDataType=URL;
}
field(70000101;Twitter;Text[50])
{
ExtendedDataType=URL;
}
field(70000102;Instagram;Text[50])
{
ExtendedDataType=URL;
}
field(70000103;Skype;Text[50])
{

}
}
}

Tuesday, November 27, 2018

How to define option String in Visual Studio Code for Dynamics 365 Business Central?

Dear Readers,

To define a option field in Visual Studio you need to write Code as :

        field(40;Type; Option)
{
            OptionMembers = "Instructor Led","e-learning","Remote Training";
            DataClassification = ToBeClassified;
        }

This will help you to define the Option Field in Visual Studio Code.

How to design a Table in AL using Visual Studio Code?

table 50100 MyTable
{
    DataClassification = ToBeClassified;
   
    fields
    {
        field(10;Code; Code [10])
        {
            DataClassification = ToBeClassified;
           
        }
        field(20;Name; Text [30])
        {
            DataClassification = ToBeClassified;
           
        }
        field(30;Description; Text [50])
        {
            DataClassification = ToBeClassified;
           
        }
        field(40;Type; Option)
        {
            OptionMembers = "Instructor Led","e-learning","Remote Training";
            DataClassification = ToBeClassified;
        }
        field(50; Duration; Decimal)
        {
            DataClassification = ToBeClassified;
        }
        field(60;Price; Decimal)
        {
            DataClassification = ToBeClassified;
           
        }
        field(70;Active; Boolean)
        {
            DataClassification = ToBeClassified;
        }
        field(80;Difficulty; Integer)
        {
            DataClassification = ToBeClassified;
        }
        field(90;"Passing Rate"; Integer)
        {
            DataClassification = ToBeClassified;
           
        }
        field(100;"Instructor Code"; Code [20])
        {
            DataClassification = ToBeClassified;
            TableRelation = Resource WHERE (Type=CONST(Person));
        }
        field(110; "Instructor Name"; Text [50])
        {
            Editable=false;
            FieldClass=FlowField;
            CalcFormula=lookup(Resource.Name where ("No."=field("Instructor Code")));
        }
    }
   
    keys
    {
        key(PK; Code)
        {
            Clustered = true;
        }
        key("Secondary Key 1"; "Instructor Code" ){}
        key("Secondary Key 2";Type){}
    }   
}

How to create flowfield in Dynamics 365 Business Central from Visual Studio Code?


Dear Readers,

This blog will show you how I created Flowfield in Visual Studio Code for my Extension. I hope

 this will help other developers to understand and refer the logic to implement for their own 

Extension Development.



Another Example :