最新消息:ww12345678 的部落格重装上线,希望大家继续支持。

D365: When and how to use postLoad() method

网络文摘 William 449浏览 0评论

Purpose:

Understand when and how to use postLoad method in data management.

Application:

Dynamics 365 for Finance and Operations

Prerequisites:

  • Basic understanding of data entities and how data management works

Business requirement:

Consider, for example, we need to add new field to standard data entity EcoResReleasedProductV2Entity to export a custom field called Manufacturer. If we come across this business requirement to add a new field to a standard data entity to export additional information then we can achieve this requirement by using the postLoad() method.

PostLoad:

PostLoad() method can be used to provide values in export scenarios for unmapped fields which are created as non-computed fields (Is Computed Field property is set to No) on a data entity. In the code below, we can see how we can use postLoad() method to populate a custom field added to a standard data entity to export additional information from released products. Please note, you will need to add a virtual unmapped field to the data entity first before you could use this code.

Code

[ExtensionOf(tableStr(EcoResReleasedProductV2Entity))]
internal final class MAK_EcoResReleasedProductV2Entity_Entity_Extension
{
    public void postLoad()
    {
        InventTable inventTable;
        MAK_ManufacturerTable manufacturerTable;

        next postLoad();

        inventTable = InventTable::find(this.ItemNumber);
        manufacturerTable = MAK_ManufacturerTable::findRecId(inventTable.MAK_Manufacturer);
        this.ManufacturerId = manufacturerTable.ManufacturerId;
    }
}
发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址