Skip to main content

Notifications

Announcements

No record found.

Business Central forum
Suggested answer

How filter sales order only the last version no

Posted on by 465
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
    TeddyH Profile Picture
    TeddyH 12,861 Moderator on at
    How filter sales order only the last version no
    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.");
  • Suggested answer
    YUN ZHU Profile Picture
    YUN ZHU 69,864 Super User 2024 Season 2 on at
    How filter sales order only the last version no
    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

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

Anton Venter – Community Spotlight

Kudos to our October Community Star of the month!

Announcing Our 2024 Season 2 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Dynamics 365 Community Newsletter - September 2024

Check out the latest community news

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 290,552 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 228,552 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,148

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans