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...
Suggested Answer

Bin List Page - SETFILTER based upon Source Page

(7) ShareShare
ReportReport
Posted on by 741
I have the following Trigger in the "Bin List" Page (7303):
 
    trigger OnOpenPage()
    begin
        Rec.SetRange("InclQtyAvail", true);
    end;
 
Works well when launched from the Sales Order Subform on the Bin Code field.
 
But now I want to do the opposite from the Purch Order Subform Bin Code field (set the filter to false).  Both use the same Bin List page.
 
Is it possible to pass the Source PageID when opening the List, and set the condition based on the PageID?
 
 
I have the same question (0)
  • Suggested answer
    YUN ZHU Profile Picture
    98,012 Super User 2026 Season 1 on at
    In this case, you cannot use the page's trigger OnOpenPage(), but instead apply the filter before the page opens.
    1. Create a procedure on the Bin List Page, for example, FilterInclQtyAvail
    2. Create a new button and execute the following process, where `page` is a variable:
    `page.FilterInclQtyAvail`
    `page.run`
     
    Hope this can give you some hints.
     
    Thanks.
    ZHU
  • Suggested answer
    OussamaSabbouh Profile Picture
    10,972 Super User 2026 Season 1 on at
    Hello,
    Yes you can do this, but not by detecting the source PageID automatically.
    You must pass a value into the Bin List page before it opens.
     
    The Bin List has no built-in way to know which page opened it.
    Create a public procedure on the Bin List page (via pageextension) to set a flag.
    In the Sales Subform → call SetInclQtyAvail(true)
    In the Purchase Subform → call SetInclQtyAvail(false)
    The OnOpenPage trigger uses that flag to set the filter.
    This is the clean and standard approach.
     
    Regards,
    Oussama Sabbouh
  • ME-31032107-0 Profile Picture
    741 on at
    I understand the concept of what you are suggesting, but am not able to get the coding correct.  Here is what I have so far.
     
    The passed variable always shows as "No".  What am I getting wrong? Thanks.
     
    On the Bin List Page
        trigger OnOpenPage()
        begin
            Message('Received Variable: %1', InclQtyAvail);
            Rec.SetRange("InclQtyAvail", InclQtyAvail);
        end;
        var
            InclQtyAvail: Boolean;
        procedure SetInclQtyAvail(Value: Boolean)
        begin

            InclQtyAvail := Value;
        end;
     
    In the Bin Code field of the SalesOrderSubform:
            modify("Bin Code")
            {
                Visible = true;
                trigger OnBeforeValidate()
                var
                    DestPage: Page "Bin List";
                    InclQtyAvail: Boolean;
                    Location: Record Location;
                begin
                    Location.Get(Rec."Location Code");
                    InclQtyAvail := true;
                    DestPage.SetInclQtyAvail(InclQtyAvail); // Pass the variable
                    Page.RunModal(Page::"Bin List", Location); // Open the page
                end;
            }
  • Suggested answer
    Jainam M. Kothari Profile Picture
    15,666 Super User 2026 Season 1 on at
    Hello,
     
    Yes, you can handle this by passing context instead of hardcoding logic.
     
    The best approach is to create a procedure in the Bin List page and call it when opening the page from each subform, so the filter is applied dynamically.
     
    This avoids relying on SourcePageID and makes the solution cleaner and easier to maintain.
     
    Alternatively, you could use RunPageLink to pass the filter directly, but parameter passing is more flexible for future changes.
  • ME-31032107-0 Profile Picture
    741 on at
     
    I am trying to determine where to place the call in the Subforms.  I have been trying different triggers on the "Bin Code" field to pass the variable, but it always returns "No.".
     
    If anyone can help debug the sample code I wrote above, I would appreciate it. Thanks.
  • Suggested answer
    RockwithNav Profile Picture
    8,846 Super User 2026 Season 1 on at
    Still thinking why do you wish to have this on purchasing side?
    Purchasing should show all the bin irrespective of what is available or not.
    Let me know if I misunderstood something.
     
  • ME-31032107-0 Profile Picture
    741 on at
     
    The answer is that all PO's are to only be received into "In-Transit" (on the water) Bins (which we are flagging as "Qty Not Available").  Once they hit Port, an Item Reclassification Journal will be made to move them to "In-Stock" (flagged as "Qty Available").
     
    Sales Orders are only to be coded to the "In-Stock" Bins.  Just trying to eliminate order entry errors.
     
    Interesting thing is that sometimes the Sales Order Subform calls the "Bin Contents" list, and sometimes it calls the "Bin List" page.
     
    Purchase Orders always seem to call the "Bin List" page.  If I can figure out Sales Order Subform logic, I might be able to have it always call the "Bin Contents" form, and that would also solve the issue.

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 2,161 Super User 2026 Season 1

#2
YUN ZHU Profile Picture

YUN ZHU 1,046 Super User 2026 Season 1

#3
Dhiren Nagar Profile Picture

Dhiren Nagar 932 Super User 2026 Season 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans