Skip to main content
Business Central forum

How to capture the last transaction of location code

editSubscribe (0) ShareShare
Posted on by 215

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.



Thank you.

  • Suggested answer
    Vaishnavi J Profile Picture
    Vaishnavi J 3,052 on at
    RE: How to capture the last transaction of location code


    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.


    ItemLedgerEntry : Record Item Ledger Entry;

    If ItemLedgerEntry.FindLast() then

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

    Below is the link for more information.

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

Helpful resources

Quick Links

What Motivates a Super User?

We know many of you visit the Dynamics 365 Community and Power Platform…

Demystifying Copilot with Georg Glantschnig…

Industry experts answer burning questions directly from our amazing Community…

Setting Up Knowledge Sources for Copilot…

Look at how configuring a comprehensive knowledge base is crucial…


Andre Arnaud de Calavon Profile Picture

Andre Arnaud de Cal... 283,030 Super User

Martin Dráb Profile Picture

Martin Dráb 222,562 Super User

nmaenpaa Profile Picture

nmaenpaa 101,138

Product updates

Dynamics 365 release plans