Monday 25 March 2019

Job to insert a record of RetailSalesTable using X++ code in D365FO

In this blog, I will discuss how to insert a record of RetailSalesTable using X++ code.

    public static void main(Args _args)
    {
        SalesTable              salesTable;
        RetailSalesTable        retailSalesTable;
        OMInternalOrganization  internalOrganization;

        salesTable = SalesTable::find("SalesOrderNumber");

        select firstonly Name, RecId from internalOrganization
            where internalOrganization.Name == RetailChannelTable::findByRecId(salesTable.RetailChannelTable).name();

        ttsbegin;
        retailSalesTable.RetailChannel = salesTable.RetailChannelTable;
        retailSalesTable.OMInternalOrganization = internalOrganization.RecId;
        salesTable.packRetailSalesTable(retailSalesTable);
        retailSalesTable.insert();
        ttscommit;
    }













That is all.

No comments:

Post a Comment

How to Get Customer Free Text Invoice "Totals" form field value with X++ in D365FO

Customer free text invoices are an essential aspect of financial management in D365FO. In this blog, I have compiled all the code needed to ...