web
You’re offline. This is a read only version of the page.
close
Skip to main content
Community site session details

Community site session details

Session Id :

Populate data from Sales quotation line to Sales order line X++

Muhammad Uzair Shah Profile Picture Muhammad Uzair Shah 201

Hi guys,

This blog will be helpful to handle such cases where in data needs to be populated from one source document to the other source document. In D365 Fin Ops, each end to end process is linked with different source documents and all these source documents have reference with each other. 

For example: Order to cash end to end process involves multiple source documents starting from Sales quotation all the way to Customer payments. 

Here is the Order to cash process follow:

Sales Quotation -> Sales order -> Picking list -> Packing slip -> Sales invoice -> Customer payments

Requirement:

Recently, I had a requirement where in customer requested to add Notes field on Sales quotation line as well as on Sales order line and wanted to populate data automatically from Sales quotation line to Sales order line. To further explain the scenario, User enters data on Notes field in Sales quotation line and this Notes data has to be populated to Notes field on Sales order line to avoid entering Notes data again in Sales order line. The purpose of this customization is to print notes on the Sales invoice lines just for the reference purpose.

Solution:

Created an extension class of Sales line table

[ExtensionOf(tableStr(SalesLine))]

final class SalesLine_Extension

{

     //This method will take care of populating Notes data from Sales quotation line to Sales order line

    //Always check if there is any initfrom method available at table level as this method will default data from one table to the other table

    public void initFromSalesQuotationLine(SalesQuotationLine _salesQuotationLine)

    {

        next initFromSalesQuotationLine(_salesQuotationLine);

        // Below line will be executed after standard MS call due to next chain of command

        // Notes data will be defaulted from source Sales quotation line to destination Sales line table

        this.Notes            = _salesQuotationLine.Notes;

    }

}

Comments

*This post is locked for comments