Monday, December 7, 2020

Display and Edit methods in D365 FO


 Hi guys, Today we see How to add the Display method, Edit method In the standard Table Using COC in D365 FO / AX 7.


Check Below Example:


[ExtensionOf(tableStr(CustGroup))]

final class CustGroup_Extension

{

    [SysClientCacheDataMethod(true)]

    display Name displayName()

    {

        return this.CustGroup + ' ' + this.PaymTermId;

    }


    Edit Name editName(boolean _set, Name _name)

    {

        Name            name    = _name;

        CustDemo        custDemo;

        ;

        if(_set)

        {

            if(name)

            {

                ttsbegin;

                custDemo = CustDemo::find(this.CustGroup,true);

                custDemo.Name  = name;

                custDemo.update();

                ttscommit;

            }

        }

        else

        {

            name    = CustDemo::find(this.CustGroup).Name;

        }

        return name;

    }

}

Create a new field in the grid. Set the data source and data method properties.

Extension methods are not visible using the drop-down,   so you use a special syntax with the style ExtensionClassName::DisplayMethod.

Keep Daxing!!

No comments:

Post a Comment