Friday, August 28, 2020

How to add a Field and a Method to a standard Table in D365 F & O/AX 7

 

Hi guys ,Today we see how to add a field and Method to a standard Table in D365.


In D365 EXTENSIONs concept is  added.In 2012  only layering concept.

ADD Field :

Run visual studio As Administrator.

Click on Application Explorer.

Right click on CustGroup Table and click on Create extension.

Table add to your Project with '.modelsuffix.

Add field in CustGroup table


ADD Method :

      For creating method we Have to create Class and that class 

  • must be final.
  • must be suffixed by _Extension.
  • must be decorated with the [ExtensionOf()] attribute.
Code

[ExtensionOf(tableStr(CustGroup))]

final class CustGroup_Extension

{

    public void insertName()

    {

        this.name= this.CustGroup;

    }

}


By using Event Handler We are adding this method to Modified Method of CustGroup Table.

For that we have to create Event Handler Class.


class CustGroup_EventHandler

{

    [DataEventHandler(tableStr(CustGroup), DataEventType::ModifiedField)]

    public static void CustGroup_onInserting(Common sender, DataEventArgs evnetArgs)

    {

        CustGroup custGroup = sender as CustGroup;

        CustGroup.insertName();

    }

}


Keep Daxing!!







No comments:

Post a Comment