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

Fetching GST Amount from CustInvoiceLine in X++ D365 F&O

Recently, I was tasked with displaying the GST amount for a free text invoice. In my source code at the backend, I only had access to the C...