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

How filter sales order only the last version no

(0) ShareShare
ReportReport
Posted on by 373
Hi community,
 
Do you know how i can filter archive sales orders only the last version?
 
 
I try to show in my cue, but still brings all version
 
 
If you know how, i will appreciate it. 
  • Suggested answer
    YUN ZHU Profile Picture
    103,085 Super User 2026 Season 2 on at
    Hi, is it possible to try getting the final version number first and then filtering with it?
    For example,
    FieldRef.GetRangeMax() Method
     
    Record.GetRangeMax(Any) Method
     
     
    Hope this helps.
    Thanks.
    ZHU
  • Suggested answer
    Teddy Herryanto (That NAV Guy) Profile Picture
    14,306 Super User 2026 Season 1 on at
    You need to loop through each order no, get the latest version, and use that version to filter on it.
     
    Example on how to get the latest version.
     
    SalesHeaderArchive.SetRange("Document Type", DocType);
    SalesHeaderArchive.SetRange("No.", DocNo);
    SalesHeaderArchive.SetRange("Doc. No. Occurrence", DocNoOccurrence);
    SalesHeaderArchive.FindLast();
    exit(SalesHeaderArchive."Version No.");

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 715 Super User 2026 Season 2

#2
AndrewThomas81 Profile Picture

AndrewThomas81 390 Super User 2026 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 386 Super User 2026 Season 2

Last 30 days Overall leaderboard

Featured topics

Microsoft Training Manuals

Product updates

Dynamics 365 release plans