web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Small and medium business | Business Central, N...
Answered

Is there any way to avoid having to use AL in this BC export scenario?

(7) ShareShare
ReportReport
Posted on by 29
What we're trying to do is create an efficient process for extracting recently updated itemLedgerEntry records from Business Central.
 
We could use this endpoint:
https://api.businesscentral.dynamics.com/v2.0/{{tenant}}/{{environment}}/api/v2.0/companies({{companyId}})/itemLedgerEntries?$filter=LastModifiedDateTime ge 2025-05-27T15:02:38Z
 
but it doesn't include fields that are valuable to use like [Lot_No] and [Location_Code], which are available at this endpoint:
https://api.businesscentral.dynamics.com/v2.0/{{tenant}}/{{environment}}/ODataV4/Company('{{companyId}}')/ItemLedgerEntries
 
.. but the issue with this latter endpoint is that there is no lastModifiedDateTime field to allow efficient incremental extracts of changed data.
 
I'm a Data Engineer with familiarity with working with APIs but have 0 familiarity with BC. I don't want to waste a load of time learning about building AL extensions if there is a far simpler solution. So if anybody could point me in the right direction of what would be best to do next that would be much appreciated! I wonder if there is something that could be done with an odata parameter to expose the lastModifiedDateTime...
 
Thanks
I have the same question (0)
  • Verified answer
    YUN ZHU Profile Picture
    95,331 Super User 2025 Season 2 on at
    Using OData is not recommended because it's less efficient than API.
    The best solution in your case is to create a custom API page/query.
    Hope the following can give you some hints.
    Dynamics 365 Business Central: Can we extend standard APIs? – Download Standard Source Code for APIs
    Dynamics 365 Business Central: API query type (Develop a custom API using Query)
     
    Thanks.
    ZHU
  • Suggested answer
    Suresh Kulla Profile Picture
    50,243 Super User 2025 Season 2 on at
    Unfortunately, for the API endpoint for you to have the fields you have need to develop a new custom API and add those fields.  There is not out of box soluiton to add the fields to the current API.
     
  • Suggested answer
    Mohana Yadav Profile Picture
    60,993 Super User 2025 Season 2 on at
  • Verified answer
    JH-14081102-0 Profile Picture
    29 on at
    Thanks for your support.
     
    I've created an AL query which seems to work - at least as far as I can tell in a sandbox with limited dummy data.
     
    namespace Microsoft.API.V2;
     
    using Microsoft.Inventory.Ledger;
     
    query 50147 "WFG_ItemLedgerEntryQuery"
    {
        Caption = 'Item Ledger Entry';
        QueryType = API;
        APIVersion = 'v3.0';
        EntityCaption = 'Item Ledger Entry';
        EntitySetCaption = 'Item Ledger Entries';
        EntityName = 'WFGitemLedgerEntry';
        EntitySetName = 'WFGitemLedgerEntries';
        APIGroup = 'WFGDataTeam';
        APIPublisher = 'WFGDataTeam';
     
        elements
        {
            dataitem(Item_Ledger_Entry; "Item Ledger Entry")
            {
                column(id; SystemId)
                {
                }
                column(entry_no; "Entry No.")
                {
                }
                column(Entry_Type; "Entry Type")
                {
                }
                column(Item_No_; "Item No.")
                {
                }
                column(Item_Description; "Item Description")
                {
                }
                column(Location_Code; "Location Code")
                {
                }
                column(Lot_No_; "Lot No.")
                {
                }
                column(Unit_of_Measure_Code; "Unit of Measure Code")
                {
                }
                column(Cost_Amount__Actual_; "Cost Amount (Actual)")
                {
                }
                column(Invoiced_Quantity; "Invoiced Quantity")
                {
                }
                column(Remaining_Quantity; "Remaining Quantity")
                {
                }
                column(SystemCreatedAt; SystemCreatedAt)
                {
                }
                column(SystemModifiedAt; SystemModifiedAt)
                {
                }
            }
        }
    }
     
    I wonder if it would be more efficient to filter this within AL using something like 
        trigger OnBeforeOpen()
        var
            ago30d: Date;
        begin
            ago30d := CalcDate('<-30D>', Today);
            currQuery.SetRange(SystemModifiedAt, CreateDateTime(ago30d, Time), CurrentDateTime);
        end;
     
    than using parameters when making API requests. Any other tips?
     
    yzhums dot com is a very helpful resource :)
     
    James
     
     
  • Suggested answer
    Sohail Ahmed Profile Picture
    11,136 Super User 2025 Season 2 on at
    You can’t get both LastModifiedDateTime and fields like Lot_No/Location_Code in one feed. Standard API gives you incremental extracts, OData gives you more fields but no change tracking. Without AL, you’d need to either join APIs or load from OData and handle deltas in your pipeline. For both in one call, a small AL API page is the only way.
     
    ✅ Mark this as the verified answer if helpful.
     
     

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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
OussamaSabbouh Profile Picture

OussamaSabbouh 3,143

#2
Jainam M. Kothari Profile Picture

Jainam M. Kothari 1,694 Super User 2025 Season 2

#3
YUN ZHU Profile Picture

YUN ZHU 1,067 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans