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

How to open page FROM A CUE with a filter set on it

(0) ShareShare
ReportReport
Posted on by 481

For example, if I were to click on the 'Ongoing Sales Invoices' cue in the Business Manager role, I want it to open the 'Sales Invoices' page with a filter set on the sale invoices. I only want this Sales Invoices Filter when I click on the cue, NOT when I go to Sales Invoices normally

Thanks

I have the same question (0)
  • Suggested answer
    Avinash B Profile Picture
    1,455 on at

    You can customize the role centre and create your own cue.

    You can do it 2 ways.

    1. Extend the table "Activities Cue", and you can create a new flowfield. The same field you can it for your cue page.

    2. You can create a global variable on the cue page, build you logic on OnOpenPage trigger to show the count and write a code on OnDrillDown trigger to open the page.

    You can refer page "O365 Activities" from base.  

  • Suggested answer
    JAngle Profile Picture
    133 on at

    This is a good guide on how to make your own: businesscentralgeek.com/2-ways-to-create-cues

  • Suggested answer
    Tabrez Ajaz Profile Picture
    785 on at

    The post shared by Josh Anglesea and comment from Avinash B both will give you a great idea how to implement and where to write code.

    Here I am sharing a complete code that looks something like this and contains multiple cues in it some showing count, some running report and also having RunObject property that you can use for opening page directly and using RunPageLink you can apply filters.

    Here is a complete page from which you can also extract some idea:

    ======================= CODE STARTS HERE ==========================

    page 50117 "Orders"
    {
    Editable = false;
    ShowFilter = false;
    RefreshOnActivate = true;
    LinksAllowed = false;

    layout
    {
    area(Content)
    {
    group(Statistics)
    {
    cuegroup("Actions")
    {
    CuegroupLayout = Wide;

    field("Total Amazon Orders"; fldTotalAmazonOrders)
    {
    Caption = 'Total Amazon Orders';
    ApplicationArea = Basic, Suite;
    ToolTip = 'Total Number of Orders in Amazon';

    }
    field("Today Created Amazon Orders"; fldTodaysAmazonOrders)
    {
    Caption = 'Today''s Amazon Orders';
    ApplicationArea = Basic, Suite;
    ToolTip = 'Number of Orders created today in Amazon';

    }
    }
    }
    group(Processes)
    {
    Caption = 'Processes & Navigation';
    grid(GridLayout)
    {
    GridLayout = Rows;
    cuegroup(Creation)
    {
    Caption = 'Creation';

    actions
    {
    action("Get Amazon Orders")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Get Amazon Orders';
    ToolTip = 'Get all Amazon Orders';
    Image = TileNew;

    trigger OnAction()
    var
    recAmazonSH: Record "Amazon Sales Header";
    recShopLocations: Record "Shop Locations";
    pageShopLocationsList: Page "Shop Locations";
    cuAmazonReqHandler: Codeunit API_AmazonRequestHandler;
    totalCreatedOrder: Integer;
    //pageAmazonOrderList: Page "Amazon Orders";
    begin
    // Code to fetch Shop Details
    if (gRecShop."Amazon API Key" <> '') and (gRecShop."Amazon API Password" <> '') then begin
    cuAmazonReqHandler.GetAmazonOrders(gRecShop, totalCreatedOrder);
    if totalCreatedOrder <> 0 then
    Message('No.of new Orders from Amazon: ' + Format(totalCreatedOrder))
    else
    Message('No new Orders to fetch from Amazon.');
    end;
    end;
    }

    action("Get Today's Amazon Orders")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Get Today''s Amazon Orders';
    ToolTip = 'Get all Amazon Today''s Orders';
    Image = TileNew;

    trigger OnAction()
    var
    recAmazonSH: Record "Amazon Sales Header";
    recShopLocations: Record "Shop Locations";
    pageShopLocationsList: Page "Shop Locations";
    cuAmazonReqHandler: Codeunit API_AmazonRequestHandler;
    totalCreatedOrder: Integer;
    //pageAmazonOrderList: Page "Amazon Orders";
    begin

    // Code to fetch Shop Details
    if (gRecShop."Amazon API Key" <> '') and (gRecShop."Amazon API Password" <> '') then begin
    cuAmazonReqHandler.GetTodayAmazonOrders(gRecShop, totalCreatedOrder);
    if totalCreatedOrder <> 0 then
    Message('No.of new Orders from Amazon: ' + Format(totalCreatedOrder))
    else
    Message('No new Orders to fetch from Amazon.');
    end;
    end;
    }
    }
    }
    cuegroup(Syncronization)
    {
    Caption = 'Sync.';
    actions
    {
    action("Sync Amazon Order")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Sync Amazon Order';
    ToolTip = 'Sync all Amazon Order';
    Image = TileNew;
    Visible = false;

    trigger OnAction()
    var
    //pageAmazonOrderList: Page "Amazon Orders";
    begin
    Message('This feature will come soon!');
    end;
    }

    action("Sync Transfer Shipment for Amazon Order")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Sync Transfer Shipment for Amazon Order';
    ToolTip = 'Sync Transfer Shipment for Amazon Order';
    Image = TileNew;
    Visible = false;

    trigger OnAction()
    var
    begin
    Message('This feature will come soon!');
    end;
    }

    action("Sync Fulfillment Status")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Sync Fulfillment Status';
    ToolTip = 'Sync Fulfillment Status';
    Image = TileNew;

    trigger OnAction()
    var
    recAmazonSH: Record "Amazon Sales Header";
    recShopLocations: Record "Shop Locations";
    pageShopLocationsList: Page "Shop Locations";
    cuAmazonReqHandler: Codeunit API_AmazonRequestHandler;
    recSH: Record "Sales Header";
    //pageAmazonOrderList: Page "Amazon Orders";
    begin
    recAmazonSH.Reset();
    recAmazonSH.SetRange("Shop Code", gShopCode);
    if recAmazonSH.FindSet() then begin
    repeat
    recSH.Reset();
    recSH.SetRange("No.", recAmazonSH."Sales Order No.");
    if recSH.FindFirst() then begin
    recSH.CalcFields("Completely Shipped");
    if recSH."Combine Shipments" then begin
    // Call Amazon Service to update the ORDER Fulfillment Status
    if (gRecShop."Amazon API Key" <> '') and (gRecShop."Amazon API Password" <> '') then begin
    ////////////////---- code here
    Message('Update Amazon Order Fulfillment Status. \\\------Feature will be available soon.-------');
    end;

    // after this Call Amazon Service to get Fulfillment Information in Fulfullment Table and Fulfillment Status
    if (gRecShop."Amazon API Key" <> '') and (gRecShop."Amazon API Password" <> '') then begin
    ////////////////---- code here
    end;
    end;
    end;
    until recAmazonSH.Next() = 0;
    end;
    end;
    }
    }
    }
    cuegroup(Lists)
    {
    Caption = 'Navigation';
    //ShowCaption = false;
    // ShowAsTree = true;

    actions
    {
    action("Amazon Order")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Amazon Orders';
    ToolTip = 'Amazon Orders List';
    Image = TileNew;
    RunObject = page "Amazon Orders";
    }
    action("Fulfilled Amazon Order")
    {
    //RunObject = page "Sales Invoice";
    Caption = 'Fulfilled Amazon Orders';
    ToolTip = 'Fulfilled Amazon Orders List';
    Image = TileNew;
    trigger OnAction()
    begin
    Message('------Feature will be available soon.-------');
    end;
    }
    }
    }
    }
    }
    usercontrol(HideControlsEditNewDelete; HideControlsEditNewDelete)
    {
    ApplicationArea = All;
    //Visible = false;
    trigger HideControlsEditNewDeleteReady()
    var
    begin
    CurrPage.HideControlsEditNewDelete.Hide();
    end;
    }
    }

    }

    trigger OnOpenPage()
    var
    recCust: Record Customer;
    recItems: Record Item;
    begin
    recCust.Reset();
    recCust.FindSet();
    fldTotalBCCustomers := recCust.Count;

    recItems.Reset();
    recItems.FindSet();
    fldTotalBCItems := recItems.Count;

    cuAPI_AmazonRequestHandler.CalculateOrdersTotals(fldTotalAmazonCustomers, fldTotalAmazonItems, fldTotalAmazonOrders, fldTodaysAmazonOrders, gRecShop);
    end;

    procedure setShop(pRec_Shop: Record Shop; pShopCode: Code[20])
    var
    begin
    gRecShop := pRec_Shop;
    gShopCode := pShopCode;
    end;

    var
    fldTotalBCCustomers: Integer;
    fldTotalBCItems: Integer;
    fldTotalAmazonCustomers: Integer;
    fldTotalAmazonItems: Integer;
    fldTotalAmazonOrders: Integer;
    fldTodaysAmazonOrders: Integer;
    cuJsonMethods: Codeunit JSON_Methods;
    cuAPI_AmazonRequestHandler: Codeunit API_AmazonRequestHandler;
    cuAPI_AmazonResponseHandler: Codeunit API_AmazonResponseHandler;
    recShop: Record Shop;
    gRecShop: Record Shop;
    gShopCode: Code[20];
    }

    ======================= CODE ENDS HERE ==========================

    Good Luck!

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 2,362

#2
YUN ZHU Profile Picture

YUN ZHU 867 Super User 2025 Season 2

#3
Sumit Singh Profile Picture

Sumit Singh 607

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans