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 :
Finance | Project Operations, Human Resources, ...
Suggested Answer

Sales Order is not confirming using x++

(0) ShareShare
ReportReport
Posted on by 2
Hi , 
 
I am creating a sales order and confirming it using x++ and written a runnable class for the same, but as I run the class the sales order is created but confirmation journal is still not activated and runnable class successfully shows the info message no error is coming on screen. 
 
 
internal final class OA_CreateSalesOrder{    /// <summary>    /// Class entry point. The system will call this method when a designated menu     /// is selected or when execution starts and this class is set as the startup class.    /// </summary>    /// <param name = /_args/>The specified arguments.</param>    public static void main(Args _args)    {                SalesTable      salesTable;        SalesLine       salesLine;        CustTable       custTable = CustTable::find('INMF-000005');        AxSalesTable    axsalesTable;        AxSalesLine     axSalesLine;        SalesFormLetter salesFormLetter;        NumberSeq       numberSeq;         try        {            ttsBegin;            numberSeq = NumberSeq::newGetNum(SalesParameters::numRefSalesId());            numberSeq.used();             salesTable.SalesId = numberSeq.num();            salesTable.initValue();            salesTable.CustAccount = 'INMF-000005';            salesTable.initFromCustTable();            salesTable.InventSiteId = 'Site 1';            salesTable.InventLocationId = '11';             if (!salesTable.validateWrite())            {                throw Exception::Error;            }            salesTable.insert();            salesLine.clear();            salesLine.initFromSalesTable(salesTable);            salesLine.SalesId = salesTable.SalesId;            salesLine.ItemId = '1104';            salesLine.createLine(true, true, true, true, true, true);            ttscommit;            //SO confirmation            salesFormLetter = SalesFormLetter::construct(DocumentStatus::Confirmation);            ttsbegin;            salesFormLetter.update(salesTable, DateTimeUtil::getSystemDate(DateTimeUtil::getUserPreferredTimeZone()), SalesUpdate::All);            ttscommit;            info(strFmt(/Sales order '%1' has been created and confirmed/, salesTable.SalesId));        }        catch (Exception::Deadlock)        {            retry;        }    }}
 
I have the same question (0)
  • Suggested answer
    MuthukumaranAX Profile Picture
    2,903 on at
    please refer the below blog
     
     
    looks like you have not assigned any sales order qty
  • Sachin Mittal Profile Picture
    2 on at
    added qty as well , still issue is same
  • Suggested answer
    Layan Jwei Profile Picture
    8,165 Super User 2026 Season 1 on at
    Hi Sachin,
     
    I think salesLine.createLine() resets the qty, salesPrice and lineAmount.
     
    Try to debug the values after this createLine method gets called and check the values of these fields.
     
    So update those salesLine fields after this createLine method before calling confirmation.
     
    Thanks,
    Layan Jweihan
    Please mark this answer as "Verified" if it solved your issue. In order to help others who will face a similar issue in the future
  • Sachin Mittal Profile Picture
    2 on at
    value for all fields is setting as they should , still journal is not created

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 527 Super User 2026 Season 1

#2
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 473

#3
Adis Profile Picture

Adis 284 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans