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

Community site session details

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

Item Quantities on all location

(1) ShareShare
ReportReport
Posted on by 101
Hello everyone,
I got a task which is a customization like add a factbox on service item worksheet, which shows selected item's quantities on all location.
Is it even possible to make this customization?
I'm stuck on this task :(
 
I have the same question (0)
  • Suggested answer
    Khushbu Rajvi. Profile Picture
    19,307 Super User 2025 Season 2 on at
  • Alexander Drogin Profile Picture
    262 on at
    Item Quantities on all location
    Very much possible, don't give up. :-)
    Essentially, all you need to do is show the value of the Inventory field from the Item record for each worksheet line. If it must be split per location, then for each location, you need to apply a filter on the Item's "Location Filter" field and run CalcFields in a loop for each location code.
  • Gerardo Rentería García Profile Picture
    23,590 Most Valuable Professional on at
  • Suggested answer
    YUN ZHU Profile Picture
    93,151 Super User 2025 Season 2 on at
    Item Quantities on all location
    Yes, it's not difficult.
    Simply put, it requires two steps.
    1. Create a ListPart page with reference to the following data
    2. Add the ListPart to the page and use the following method to associate the lines.
     
    Hope this can give you some hints.
    Thanks
    ZHU
  • TB-28100618-0 Profile Picture
    101 on at
    Item Quantities on all location
    Thanks for your replies!
    It calculates perfectly but when I select other line on Service Line then table changes but factbox cant be changed.
    I tried Currpage.Update(False) but not working
     

  • TB-28100618-0 Profile Picture
    101 on at
    Item Quantities on all location
    I did not use SubPageLink because I thought there was nothing to link Worksheet Page and Factbox page
     
  • Verified answer
    Alexander Drogin Profile Picture
    262 on at
    Item Quantities on all location
    You are on the right track, but there are certainly a few things to fix.
     
    1. Regarding the SubPageLink property - it is not so much about the type of the subpage (factbox or document lines), it rather depends on what kind of data is presented in the subpage. If you want to keep the location records in a temporary table and reset it on the main page update, then be it, you don't need SubPageLink.
     
    2. The main problem is that page objects are not singletons. Every page variable in your code is a new instance of the page, unrelated to what is actually displayed in the main page. For this reason, ServiceItemWorksheetPage.Update does not do anything visible in the client. The right way to update the subpage in this case is via CurrPage."Item Quantities".Page. This way you are referring to the actual instance rendered in the client. All triggers in the page extension should call the update function in the factbox this way. And you can delete all local page variables, you don't need them.
     
    3. The source table for the Item Quantities Factbox page is not actually temporary (I mean temporary as an in-memory table). Your code actually inserts records into a table that exists in the database. This is slower compared to in-memory operations, and also unsafe, because multiple users opening this page simultaneously will be deleting each other's records. This page will be a mess in concurrent sessions.
     
    4. Looping on item ledger entries is not fastest way of calculating the sum. Use CalcSums("Remaining Quantity") or Item.CalcFields(Inventory), this will be way faster.
  • TB-28100618-0 Profile Picture
    101 on at
    Item Quantities on all location
    Hey! Alexander Drogin
    Thanks for your kind reply and suggestions!
     

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
Rishabh Kanaskar Profile Picture

Rishabh Kanaskar 3,750

#2
Sumit Singh Profile Picture

Sumit Singh 2,689

#3
YUN ZHU Profile Picture

YUN ZHU 1,987 Super User 2025 Season 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans