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

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Dynamics 365 Community / Forums / Finance forum / Complete Sales Order t...
Finance forum

Complete Sales Order through code

(2) ShareShare
ReportReport
Posted on by

I am looking for a way to automate sales order completion through code. Any help or clue will be appreciated.

8688.CompleteSalesOrder.PNG

  • Community Member Profile Picture
    on at

    I think you have to enable the sales order completion from setup. Also it appears only for the open order which hasn't been confirmed yet.

  • Verified answer
    Community Member Profile Picture
    on at

    Following snippet will do the job.

            SalesTable salesTable = SalesTable::find(salesOrder.parmSalesId());
            MCRSalesOrderTotals mcrSalesOrderTotals = new MCRSalesOrderTotals(salesTable, true);
    
            //complete
            MCREndOrder::endOrder(salesTable.SalesId, true, mcrSalesOrderTotals, false);


  • RobHaigh Profile Picture
    2 on at
    Hi... Know this is an old thread but...

    Wondering if anyone can shed any more light on this.

    My problem - 
    Via powerapps I can create sales order headers and sales order lines in Finops.
     
    BUT
     
    I cant confirm or complete the order programatically.
     
    The code snippet in this thread seems to be the only thing i can find but, I have no idea how to use it or indeed even if it can be used in powerapps....

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

November Spotlight Star - Khushbu Rajvi

Congratulations to a top community star!

Forum Structure Changes Coming on 11/8!

In our never-ending quest to help the Dynamics 365 Community members get answers faster …

Dynamics 365 Community Platform update – Oct 28

Welcome to the next edition of the Community Platform Update. This is a status …

Leaderboard > Finance

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans