Thursday, November 26, 2020

Extensions of Forms using COC in D365 FO/AX 7.0

 Hi guys, Today we see how to Extend the form by COC(chain of command) in D365 FO/ AX 7.0.



Form DataSource Extension:


[ExtensionOf(formDataSourceStr(CustGroup, CustGroup))]

final class CustGroupMy_Extension

{

    public void init()

    {

        CustGroup   custGroup;

        next init();

        while select forupdate custGroup

            where !custGroup.Description

        {

            ttsbegin;

            custGroup.Description = custGroup.CustGroup + ' ' + custGroup.Name;

            custGroup.update();

            ttscommit;

        }

         }

}


Form DataSource Field Extension:


[ExtensionOf(formDataFieldStr(CustGroup, CustGroup, Name))]

public final class CustGroup_Extension

{

    public void modified()

    {

        CustGroup       custGroup;

        FormDataSource  fds;

        FormDataObject  fd = any2Object(this) as FormDataObject;

        next Modified();

        fds = fd.datasource();
        //fds =  element.CustGroup_ds;

        custGroup = fds.cursor();

        custGroup.Description = custGroup.custGroup +' '+custGroup.name;

    }

}


Keep Daxing!!

No comments:

Post a Comment