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, ...
Suggested Answer

About Number Sequence

(0) ShareShare
ReportReport
Posted on by 390

Hey Team,

Can someone please explain me this code for getting the next number from number sequence.I'm confused with NumberSequenceReference and NumberSequenceTable. Please explain me this snippet of code as I'm new to number sequence.

        NumberSequenceReference numberSequenceReferencePosition = NumberSeqReference::findReference(extendedTypeNum(HcmPositionId));
        NumberSequenceTable numberSequenceTablePosition = NumberSequenceTable::find(numberSequenceReferencePosition.NumberSequenceId);
        if (numberSequenceReferencePosition && numberSequenceTablePosition)
        {
            if (!numberSequenceTablePosition.Manual)
            {
                NumberSeq numberSeqPosition = NumberSeq::newGetNumFromId(
                    numberSequenceTablePosition.RecId,
                    true,
                    true,
                    sysLastValue,
                    false);
 
                if (numberSeqPosition)
                {
                    positionId = numberSeqPosition.num();
                }
            }
        }

I have the same question (0)
  • Suggested answer
    vinitgoyal2005 Profile Picture
    6,332 on at

    Hi Skd,

    Check documentation: docs.microsoft.com/.../number-sequence-overview for number sequence understanding.

    NumberSequenceTable contains all the information about number sequences like format, continuous, next number etc. ave a look at the table fields. and number sequence form in UI.

    Same number sequence can be used in multiple places. Reference tables holds this link.

  • Suggested answer
    Martin Dráb Profile Picture
    237,803 Most Valuable Professional on at

    It finds a number sequence reference for HcmPositionId type. Then if finds the corresponding NumberSequenceTable and if it's Manual, it gets a new ID from the number sequence and assign it to positionId variable.

    It looks trivial; it's not clear where you got lost.

  • Blue Wang Profile Picture
    on at

    HI Skd,

    NumberSequenceTable record is a number sequence.

    If you have a reference, you can find the sequence by NumberSequenceId field in NumberSequenceReference table.

    So you should to get your reference and then to find seuence,like code that:

    NumberSequenceTable::find(numberSequenceReferencePosition.NumberSequenceId)

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 664 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 303 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans