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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Answered

Number sequence is skipping one when creating a sales order by code

(0) ShareShare
ReportReport
Posted on by 1,967

Hi,

I'm creating a sales order by code and whenever an order is created I noticed that the number sequence jummp1 each time. Example

SO1,SO2,SO4 even without errors..but manually it generates correctly.

I'm using NumberSeq::newGetNum(Sales parameters:'numRefSalesId()).num()

I have the same question (0)
  • Gunjan Bhattachayya Profile Picture
    35,423 on at

    Hi IntegrationBeginner,

    Please share your code for creating sales orders. Maybe the number sequence code is getting called twice which is why you are seeing a jump in the sales Id generated.

    You can also try by commenting the code you mentioned above to see if sales orders are getting generated with the correct number sequence.

  • .. Profile Picture
    1,967 on at

    Hi Gunjan,

    Commenting this line didn't create the order because SalesId needs to be filled

    However, I confirm and deliver the sales order in the service as well based on some flags.

    I tried to comment both confirm and deliver and the salesId was correct and in sequence. Then I added the confirm back alone but it started skipping again

    Here is what I use for confirm

           SalesFormLetter salesFormLetter = salesFormLetter::construct(DocumentStatus::Confirmation);

           salesFormLetter.update(_salesTable, systemDateGet(), SalesUpdate::All);

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,423 on at

    Confirmation code looks fine. Maybe it's not an issue with code, but has to do more with number sequence setup.

    Can you check if the sales order number sequence is being used for Confirmation number sequence under AR > Setup > AR parameters > Number sequence tab?

    pastedimage1646123932763v1.png

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 451 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 428 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans