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 :
Microsoft Dynamics AX (Archived)

How to delete a manually created numberseq

(0) ShareShare
ReportReport
Posted on by 1,307

Hi,

I have an uneditable master table and new records must be inserted only through New Button.

A dialog box is called in new button\clicked method. Dialog has two string fields, (Name and Description).

After the fields are set and clicked OK,

I have to insert the record in the master table.

ttsBegin;;

        WorkStation.clear();

        WorkStation.initValue();

        WorkStation.StationName     = dlgStationName.value();

        WorkStation.WSDescription   = dlgDescription.value();

        numberseqId                 = NumberSeqReference::findReference(ExtendedTypeNum(SMCStationId)).numberSequenceId;

        numberSeq                   = NumberSeq::newGetNumFromId(numberseqId);

        WorkStation.StationId       = numberSeq.num();   

if(WorkStation.validatewrite());

                WorkStation.insert();

ttscommit;

But if the validation is throwing error, the numberseq created is not reverting back.

Could someone explain me how to revert the numberseq?

 

 

Thanks,

Lakshmi

 

       

 

 

 

    

 

       

 

 

 

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    André Arnaud de Calavon Profile Picture
    303,674 Super User 2026 Season 1 on at

    Hi Lakshmi,

    This is standard behavior. If the number sequence supports continuous, you can use the optional parameter _makeDecisionLater when retrieving a new number in the NumberSeq class.

    Then after the insert you need to add the next statement: numberSeq.used();

    This will ensure the status of the number will be finalized then.

  • Verified answer
    5400 Profile Picture
    7,162 on at

    please find link

    dynamicsaxinsight.wordpress.com/.../generate-next-number-sequence-in-code

    As andre told, you have to used  numberSeq.used();// If everything is successful, and the number should be persisted

    and

    numberSeq.abort();// If something went wrong later, and the number should be cleared

  • Lakshmi Karambakkam Profile Picture
    1,307 on at

    HNextRec_5F00_InNumberSeqTable.png"color:#00008b;font-family:Consolas;font-size:xx-small;">boolean parmMakeDecisionLater(boolean _makeDecisionLater)

    {

    makeDecisionLater = false;

    return makeDecisionLater;

    }

    So even though I set makeDecisionlater as true, it is not considering it.

    Please let me know how to solve this.

     

    Thanks,

    Lakshmi

     

             

     

    So even after abort, the number is generating a new number, but not using the last released number

  • Lakshmi Karambakkam Profile Picture
    1,307 on at

    I made the number sequence continuous, so now its taking makeDecisionLater parameter

    as TRUE.

    I used TRY CATCH to handle insertion, because if validation throws error, we need catch statement to abort and retrieve the numberseq  back.

    Thanks for everyone who helped.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Joris dG Profile Picture

Joris dG 5

#2
Alexey Lekanov Profile Picture

Alexey Lekanov 2

#2
Henrik Nordlöf Profile Picture

Henrik Nordlöf 2 User Group Leader

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans