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 :
Small and medium business | Business Central, N...
Suggested Answer

Row number in sales line page

(1) ShareShare
ReportReport
Posted on by 16
How to get selected row number in sales line?  or selected row number in any list page ?
 
I have the same question (0)
  • soma Profile Picture
    24,410 on at
    Do you want to count the row number? or get the selected row line number?
  • Sathiyamoorthy Profile Picture
    16 on at
    I want the row number 7 as highlighted below 
     
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,803 Super User 2026 Season 1 on at
    Hi,
     
    I think you can use "Line No." fields in Sales Line Table.
     
    Best regards,
    Mohamed Amine MAHMOUDI
  • Sathiyamoorthy Profile Picture
    16 on at
    Line number having 10000,15000, 20000,30000,..........etc, I need line number like 1,2,3,4,5,....etc
  • Suggested answer
    Mohamed Amine Mahmoudi Profile Picture
    26,803 Super User 2026 Season 1 on at
    Hi @Sathiyamoorthy,
     
    try this :
                action("Get seq number")
                {
                    ApplicationArea = All;
    
                    trigger OnAction()
                    var
                        SalesLine: Record "Sales Line";
                        seq: Integer;
                    begin
                        SalesLine.SetRange("Document Type", Rec."Document Type");
                        SalesLine.SetRange("Document No.", Rec."Document No.");
                        SalesLine.SetRange("Line No.", 0, Rec."Line No.");
                        seq := SalesLine.count();
                        Message(Format(seq));
                    end;
                }
    Best regards,
    Mohamed Amine MAHMOUDI
  • Gerardo Rentería García Profile Picture
    26,091 Most Valuable Professional on at
    Hi
    If you want the row numbers to be unique, do not change and are directly related to the row, I would tell you to create a field where you update the row number, and with each insertion you increment it.
    As you have indicated, the "line number" is created with large range numbers, because they allow new rows to be created in the middle.
    If you want to have visibility of the number of lines in a document, this could help you.
    BR
    GR
  • CU29041409-0 Profile Picture
    35 on at
    In Microsoft Business Central, you can get the selected row number in a list page by using the GETRECORDID function. This function returns the unique identifier of the selected record in the list. You can then use this identifier to retrieve additional information or perform actions related to the selected record. Here's an example of how you can use GETRECORDID:RecRef.GETTABLEVIEW(Page::"YourPageName").GETRECORDID(); Replace "YourPageName" with the name of the page where you want to get the selected row number. This code will return the record ID of the selected row in the specified page.

     

  • Suggested answer
    YUN ZHU Profile Picture
    99,978 Super User 2026 Season 1 on at
    Hi, not sure if you want to get this line number in the code? Hopefully the information below can give you some tips.
    Dynamics 365 Business Central: How to get a filter for the selected records on any page (For example, ‘1..3|6’)
     
     
    Thanks.
    ZHU
  • Judy Profile Picture
    Microsoft Employee on at
    Hi, if your issue has resolved, please mark the helpful answers so that you can help others who have the same question on the community.

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Small and medium business | Business Central, NAV, RMS

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 2,024 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,145 Super User 2026 Season 1

#3
Khushbu Rajvi. Profile Picture

Khushbu Rajvi. 705 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans