Tuesday, January 24, 2023

update custom fields in PurchTable from SalesTable while creating purchase order from sales order in D365FO

 I got a requirement to update custom fields in PurchTable from SalesTable while creating purchase order from sales order in D365FO.


For this I have extended the "PurchAutoCreate_Sales" class.


[ExtensionOf(classStr(PurchAutoCreate_Sales))]
public final class PurchAutoCreate_Sales_Extension //extends     PurchAutoCreate
{
        // Populating header details
	void setPurchTable()
	{
	    next setPurchTable();

	    /*if (!salesLine)
	    {
			salesLine = SalesLine::findRecId(tmpPurchLinePrice.SalesLineRefRecId, true);
	    }*/

	    purchTable.NewField1 = salesTable.NewField1;
	}

	// Populating Line details
	protected PurchLine initPurchLine()
	{
	    PurchLine localPurchLine = next initPurchLine();

	    localPurchLine.NewField1 = salesLine.NewField1;
	}
}


Keep Daxing!!

No comments:

Post a Comment