Tuesday, April 30, 2019

Extension(CoC) class for DP classes in dynamics 365 finance and operations x++

Recently I gone through creating an extension class known as CoC for a DP for inserting some values for header and lines in purchase order confirmation report.

This will give you an idea how to extend methods. Please change it according to your requirement.

[ExtensionOf(classStr(PurchPurchaseOrderDP))]
final class PurchClass_PurchPurchaseOrderDP_Extension
{
    protected PurchPurchaseOrderTmp initializeOrderLine(
        PurchPurchaseOrderHeader                    _purchaseOrderHeader,
        boolean                                     _highlightUpdated,
        PurchPurchaseOrderDPOrderLineQuerySelection _orderLineSelection)
    {
        PurchPurchaseOrderTmp purchPurchaseOrderTmp = next initializeOrderLine(_purchaseOrderHeader, _highlightUpdated, _orderLineSelection);

        purchPurchaseOrderTmp.CustomInventBatchId = _orderLineSelection.parmPurchLineAllVersionsInventDim().inventBatchId;
        purchPurchaseOrderTmp.Name = InventTable::find(purchPurchaseOrderTmp.ItemId).productName('en-us');

        return purchPurchaseOrderTmp;
    }

    protected PurchPurchaseOrderHeader initializePurchaseOrderHeader(VendPurchOrderJour _vendPurchOrderJour)
    {
        PurchPurchaseOrderHeader purchPurchaseOrderHeader = next initializePurchaseOrderHeader(_vendPurchOrderJour);

        PurchTable purchTable = _vendPurchOrderJour.purchTable();
       
        purchPurchaseOrderHeader.CustomPurchId  = purchTable.PurchId;
        purchPurchaseOrderHeader.CustomVendName       = purchTable.PurchName;

        return purchPurchaseOrderHeader;
    }

}

@Rahul


No comments:

Post a Comment

Why do users often get confused about Dynamics 365 Customer Engagement (D365 CE), Dataverse, and the Power Platform?

  The Microsoft ecosystem for business applications can sometimes be difficult to navigate, especially when discussing Dynamics 365 Customer...