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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Can't add methods to data entity extension for computed columns

(0) ShareShare
ReportReport
Posted on by 1,424

Problem:

System doesn't allow me to add a new method to my data entity extension of standard entity SalesOrderLineEntity. I have to use the new method as a DataEntityView method for a computed field that I have successfully added to my extended data entity. How can I add a new method to my data entity extension? Is there any alternative to this approach. I also tried augmentation class for my data entity but no luck.

2626.Image1.png

Background:

The requirement is to add some computed fields to the standard SalesOrderLineEntity data entity which can be sent to an external system. For this reason, I have extended the SalesOrderLineEntity in my model. Then added the custom fields. But I am not able to add a new method to my extended data entity to be used as a DataEntityView method. Please advise. Thanks!

5340.Image2.png

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    239,381 Most Valuable Professional on at

    Adding methods to data entity extensions isn't possible (which is the same in case of other extensions as well), but it doesn't mean that you can't add a computed column.

    Create a static method in a separate class and refer to this method from DataEntityView Method property. For example, if you create method1() in Class1, the value of DataEntityView Method should be Class1::method1.

  • Mark Kopan Profile Picture
    245 on at

    With the removal of the AIF Framework and underlying business logic to be used with EDI trading partners, I believe Microsoft has effectively neutered much of the ability to leverage Data Entities for use in EDI Transactions. Whilst many Trading partners only send their ExternalItemId and an Address Code rather than an actual delivery address [AMAZON for one]. With AIF i was able to craft a simple lookup in the AxdClasses where if(!ItemID && ExternalItemId) lookup Item from custVendExternalItem table and apply it to SalesLine.ItemId.  Now all I want to do is this simple lookup and swap in the Source to Staging for the Data Entity SalesOrderLineV2Entity. Either MS needs to add that to the base validations on the entity or let us extend the logic.

  • Pradeep_Prakash Profile Picture
    717 on at

    Hi Martin,

    I have a similar situation here. I want to add ProductName to PurchPurchaseLineEntity.

    How can I get the buffer in the static method, so that I can call the Purchline.ItemName() directly and return using syscomputedcolumn.

    public static itemName getProductName()
    {
             DataEntityName dataEntityName= tablestr(PurchPurchaseOrderLineEntity);

    }

    Regards,

    Pradeep

  • Martin Dráb Profile Picture
    239,381 Most Valuable Professional on at

    Why are you creating a computed column if your goal is adding a field?

    Also, your code suggest that you don't know what a computed column is. You're trying to return item name from the method, but the method should return a piece of SQL code that will be inserted to the view in database.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
CP04-islander Profile Picture

CP04-islander 39

#2
Michel ROY Profile Picture

Michel ROY 14

#3
imran ul haq Profile Picture

imran ul haq 8

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans