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 capture the last transaction of location code

(0) ShareShare
ReportReport
Posted on by 261

Hi all experts,

I'm new to AL language.
I want to capture the location code in the Item Ledger Entry - Last transaction of the location code (Highlighted in Red Box)

As currently my report is printed the location code with first record, so now i wish to capture the last record of location code.

I direct pulled the field location code in item ledger entry, but it print the first record in report layout.

How can i write the code and print in the report?

Below is my screenshot.

pastedimage1644841461319v1.png

pastedimage1644841483334v2.png

Thank you.

I have the same question (0)
  • Suggested answer
    Vaishnavi J Profile Picture
    3,094 on at

    Hi

    you can use FindLast function to get the last record.

    and then  you have to create a report if you have it then simply use its ID in RunModal Function.

    Example:

    ItemLedgerEntry : Record Item Ledger Entry;

    If ItemLedgerEntry.FindLast() then

                               Report.RunModal(50101, true, true, ItemLedgerEntry);

    Below is the link for more information.

    docs.microsoft.com/.../record-findlast-method

    docs.microsoft.com/.../page-runmodal--method

    If my answer was helpful to you, please verify it so that other users know it worked. Thank you very much.

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!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 1,804 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,103 Super User 2026 Season 1

#3
Kamal Khakhkhar Profile Picture

Kamal Khakhkhar 695

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans