Tuesday, 30 April 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

Adding a newline into a string in C# and X++

Below is the sample code we can use for  adding a newline after every occurrence of "@" symbol in the string in C#   using System...