Skip to main content

Notifications

Community site session details

Community site session details

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

how linenum gets assigned in the purchase line???

(0) ShareShare
ReportReport
Posted on by 439

Hi all,

I am developing a form which is similar to the purchase order and  where as I have a header table and line table.

In line table I have added the a field linenum and I wanted to know how the linenumber gets assigned every time we create a new record in the purchase line so that I can implement that thing in my form too,

Please through some lights on that.

SO far I have added  a field and added the same EDT which is given over there in the purchase line but not sure how the purchase line number gets assigned every time we create a new line.

Thanks you

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how linenum gets assigned in the purchase line???

    Hi Rohit,

    Were you able to resolve this issue as well? In case you did, please mark the correct answer(s) as verified.

  • Suggested answer
    vinitgoyal2005 Profile Picture
    6,330 on at
    RE: how linenum gets assigned in the purchase line???

    Hi,

    You will find most tables which have a LineNumber column contains method LastLineNum, you will have a similar implementation in all tables.

    You need to do the exactly same for your your custom table.

  • Suggested answer
    Sergei Minozhenko Profile Picture
    23,091 on at
    RE: how linenum gets assigned in the purchase line???

    Hi Rohit,

    The simplest way is overriding the insert method on your line table and initialize the line number before super.

    Check the example in PurchRFQCaseLine.Insert and line

    this.LineNum = PurchRFQCaseLine::lastLineNum(this.rfqCaseId)   1.0;

  • Suggested answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how linenum gets assigned in the purchase line???

    Rohit,

    You can check Data entities\SalesOrderLineV2Entity\insertEntityDataSource() method as well. This code sets the line number -

    salesLine.LineNum = salesLine.LineNum ? salesLine.LineNum : SalesLine::lastLineNum(this.SalesOrderNumber)   1;

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how linenum gets assigned in the purchase line???

    I am not sure. I think it is using the same class as it has the same structure.

    You can debug to be sure.

  • rohit1900 Profile Picture
    439 on at
    RE: how linenum gets assigned in the purchase line???

    Hi what is the class for the sales line? like how TradeLineNumberManager is for the purchline

  • Verified answer
    Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how linenum gets assigned in the purchase line???

    You can step into this method -

    TradeLineNumberManager::updateLineNumberOfNewOrder(this);

  • rohit1900 Profile Picture
    439 on at
    RE: how linenum gets assigned in the purchase line???

    I think it i going inside the method

  • Gunjan Bhattachayya Profile Picture
    35,421 on at
    RE: how linenum gets assigned in the purchase line???

    Can you try placing a breakpoint on Purchline\insert and try?

  • rohit1900 Profile Picture
    439 on at
    RE: how linenum gets assigned in the purchase line???

    yes it is same... as you mentioned

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

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Adis Hodzic – Community Spotlight

We are honored to recognize Adis Hodzic as our May 2025 Community…

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

#1
Martin Dráb Profile Picture

Martin Dráb 510 Most Valuable Professional

#2
Saalim Ansari Profile Picture

Saalim Ansari 315

#3
Adis Profile Picture

Adis 312 Super User 2025 Season 1

Overall leaderboard

Product updates

Dynamics 365 release plans