Powered By Blogger
Showing posts with label Data Entity. Show all posts
Showing posts with label Data Entity. Show all posts

How to add fields in standard Data entity in D365 using X++

Here my requirement is to add fields in header and line data entities.

   ·       Warehouse work header

   ·       Warehouse work Lines

Add fields in entity level , vertual fields.

Add fields with same names in staging tables

Header dataentity postload method:

[ExtensionOf(tableStr(WHSWarehouseWorkHeaderEntity))]

internal final class DaxWHSWarehouseWorkHeaderEntity_Extension

{

      public void postload()

    {

        WHSWorkTable    whsWorkTable;

        WHSWorkLine     whsWorkLine;

        WHSWarehouseWorkHeaderEntity    wHSWarehouseWorkHeaderEntity = this;

        Amount qty,qtyloc;

        while  select whsWorkLine

             where whsWorkLine.WorkId == wHSWarehouseWorkHeaderEntity.WarehouseWorkId

        {

            qty += whsWorkLine.QtyWork;

            qtyloc += whsWorkLine.QtyRemain;

        }

        wHSWarehouseWorkHeaderEntity.QtyWork = qty;

        wHSWarehouseWorkHeaderEntity.QtyRemain = qtyloc;

        next postload();

    }

  }

Line Dataentity postload method :

[ExtensionOf(tableStr(WHSWarehouseWorkLineEntity))]

internal final class DaxWHSWarehouseWorkLineEntity_Extension

{

    public void postload()

    {

        Inventbatch     inventBatch;

        WHSWarehouseWorkLineEntity whsWarehouseWorkLineEntity = this;

          select inventBatch

            where inventBatch.itemId == whsWarehouseWorkLineEntity.WarehouseWorkId

            && inventBatch.inventBatchId == whsWarehouseWorkLineEntity.ItemBatchNumber;

        whsWarehouseWorkLineEntity.ExpDate = inventBatch.expDate;

        whsWarehouseWorkLineEntity.ItemName = InventTable::find(whsWarehouseWorkLineEntity.ItemNumber).itemName();

        next postload();

            }

  }



 

DisableStandredButton

 My requirement is to disable the delete button for journals that were posted:- After Posting the button is enabled fig:- Line level also th...