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...
Answered

How to set Sr no automatic.

(0) ShareShare
ReportReport
Posted on by 153

Hii guys,

For example: Here ,My column is sr.no,and this sr.no is a primary key .I write this logic,but I am getting output in sr no start with 0.

I want sr .no starts with 1.

Is there is any way to do this.

pastedimage1676987489638v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Hi,

    You can set field property as per below,

    AutoIncrement=true;

    learn.microsoft.com/.../devenv-autoincrement-property

  • Suggested answer
    Nilam Bhor Profile Picture
    153 on at

    No. Actually I want write a logic for sr no gets automatic.

    We don't want autoincrement property.

    My result is come, but it starts with 0.

    I want number starts with 1.

    pastedimage1676992184836v1.png

  • Suggested answer
    Nitin Verma Profile Picture
    21,812 Moderator on at

    Try below code

      trigger OnInsert()
    var
    YourTable: Record YourTable;
    begin
    "Entry No." := 1;
    YourTable.Reset();
    YourTable.SetRange("Entry No.");
    if YourTable.FindLast() then
    "Entry No." := YourTable."Entry No." + 1;
    end;
    ;
  • Nilam Bhor Profile Picture
    153 on at

    Thank you .It works.

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Women in Power Builds Momentum

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders

These are the community rock stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 674 Super User 2026 Season 2

#2
YUN ZHU Profile Picture

YUN ZHU 362 Super User 2026 Season 2

#3
AndrewThomas81 Profile Picture

AndrewThomas81 359 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans