web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :

How to extend or overwrite dataentity methods in D365 Finance and Operations X++?

Rahul Kiran Profile Picture Rahul Kiran 481
In this example I will be showing how to extend or overwrite dataentity methods.

In D365 7.1 and later versions Microsoft is not allowing to overwrite the standard objects. To overcome this, we need to use extensions.

We follow the same concept for extending tables, forms and classes methods.


Below example I'm overwriting/extending postload method in SalesOrderHeaderV2Entity entity.

Here I'm assigning sales order createddatetime value to some custom field.


[ExtensionOf(tableStr(SalesOrderHeaderV2Entity))]
final class SWClass_SalesOrderHeaderV2Entity_Extension
{
   

    public void postload()
    {
        next postload();
       
        SalesOrderHeaderV2Entity SalesOrderHeaderV2Entity = this;
       

        SalesTable                  salesTable = SalesTable::find(SalesOrderHeaderV2Entity.SalesOrderNumber);

       
        SalesOrderHeaderV2Entity.customdate += date2Str(salesTable.createddateandtime, 213,
                                                                DateMonth::Digits2,
                                                                DateSeparator::Slash,
                                                                DateDay::Digits2,
                                                                DateSeparator::Slash,
                DateYear::Digits4);
        }
               
    }

}


In the same way you can extend other methods as well.

@Rahul 

This was originally posted here.

Comments

*This post is locked for comments