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

Community site session details

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

Number Sequence reference

(0) ShareShare
ReportReport
Posted on by 390

Hey team,

Can anyone tell me the numbersequence reference for PartyNumber and position?

I have used the following reference:

For Party Number:

NumberSequenceReference numberSequenceReference = NumberSeqReference::findReference(extendedTypeNum(DirPartyNumber));
NumberSequenceTable numberSequenceTable = NumberSequenceTable::find(numberSequenceReference.NumberSequenceId);

For Position

NumberSequenceReference numberSequenceReferencePosition = NumberSeqReference::findReference(extendedTypeNum(HcmPositionId));
NumberSequenceTable numberSequenceTablePosition = NumberSequenceTable::find(numberSequenceReferencePosition.NumberSequenceId);

Please tell me if this is right or should it be something else?

I have the same question (0)
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Number Sequence reference
    [deleted]
  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Number Sequence reference

    Call smmParameters::numRefPartyNumber() method to get it.

    For HcmPosition you can use HcmPosition::getNewPositionId to get a new position id (or see how the number seq reference is fetched).

    You can use cross references (right click the EDT -> Find references) to find this kind of information.

  • skd Profile Picture
    390 on at
    RE: Number Sequence reference

    Hey Nikolaos Mäenpää ,

    Can you please write down the code snippet for me for the next partyNumber and PositionId. I'm very confused.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Number Sequence reference

    If you want to get next party number, just use cross references and see how smmParameters::numRefPartyNumber() is used. Clearly some process which wants to get the next party number is calling it. So you just need to find this info from the cross references.

    And forthe next position id, there's no other code snippet, I alredy told that you can call HcmPosition::getNewPositionId() to get a new position id.

    Or perhaps I don't understand your requirement. In this case, could you help me understand?

    I'm trying to help you in a way that you can help yourself better in the future - not just providing exact direct answer but instead telling you how to find out this kind of information.

  • skd Profile Picture
    390 on at
    RE: Number Sequence reference

    Hey Nikolaos Mäenpää ,

    I did get a solution for PositionId but for PartyNumber I'm not able to figure out. I will show you the code snippet which I wrote. You please tell me what is wrong.

    DirPartyTable d;
    NumberSequenceReference numberSequenceReference = NumberSeqReference::findReference(extendedTypeNum(DirPartyNumber));
    NumberSequenceTable numberSequenceTable = NumberSequenceTable::find(numberSequenceReference.NumberSequenceId);
    if (numberSequenceReference && numberSequenceTable)
                {
                   if (!numberSequenceTable.Manual)
                    {
                        NumberSeq numberSeq = NumberSeq::newGetNumFromId(numberSequenceTable.RecId,
                                                                       true,
                                                                       true,
                                                                       sysLastValue,
                                                                       false);
    
                
                
    
                        if (numberSeq)
               
                        {
                            d.PartyNumber = numberSeq.num();
                        }
                    }
                }
    
    
                d.PartyType=partyType;
                d.PartyType="Person";
    d.insert();

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Number Sequence reference

    Hi skd,

    it seems that so far you didn't check my previous suggestion, instead you are still using the code from your initial message. I suggest to check what I already wrote, and try it. Thanks!

    Also, I don't think that your code snippet even compiles, so you can't yet have tested it yourself. Line 27 will definetely show you a compiler error, because you are trying to assign a string value to an enum field.

  • skd Profile Picture
    390 on at
    RE: Number Sequence reference

    Hey Nikolaos Mäenpää ,

    I did see your suggestion but I just wrote down my previous code which i had written to show you. I was confused as when I used "smmParameters::numRefPartyNumber()" I got some errors therefore I wasn't very sure how do I use this method so thought so asking you by showing my previous code. Also my code is getting compiled and  its running so please suggest me what should I do.

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Number Sequence reference

    If you got some errors, then you could share your code and the errors and we could look at them together.

    However if you now have code that you can compile and run, then I suggest that you test it.

  • skd Profile Picture
    390 on at
    RE: Number Sequence reference

    Hey Nikolaos Mäenpää ,

    Thank you I found the solution.

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,004

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 548 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans