Wednesday, February 11, 2015

Dynamics NAV - How to modify default filters when a page is opened from clicking a button in the ribbon


Buttons in the Ribbon are created through Page Actions
  1. Open Development Environment
  2. Find Page>Design
  3. View>Page Actions
  4. Select Action
  5. View>Properties
  6. Find the RunPageLink field
  7. Select the value, click on the three dots to open the field selection
  8. Each field on the left is a filter that can be added to the page that will open. Select Type FIELD. Each field on the right is a field from the original page that will be used as the filter value
This method does not work on Custom Reports.
To get a Custom Report to open with a filter

  • Clear the RunObject property on the PageAction Button
    • This leaves you with Just a button that does nothing
  • Use CAL code on the Page Action to set the report filters and launch the report.
    • Read current Record into a Variable
    • Set the Range on the Record to the current record
    • Run the report passing in the Range options set on the Giftrec
  • In this example, GiftRec is a local Record


<Action1200000013> - OnAction()
GiftRec := Rec;
//MESSAGE(GiftRec."No.");
GiftRec.SETRANGE("No.",GiftRec."No.");
REPORT.RUNMODAL(50010,TRUE,TRUE,GiftRec);


action("Adv. Item Bin Contents")
            {
                CaptionML = ENU = 'Adv. Item Bin Contents';
                ApplicationArea = All;
                Image = ShowMatrix;
                RunObject = Page "Adv. Item Bin Contents";
                RunPageLink = "Item No." = Field("No.");
                Promoted = true;
                PromotedCategory = Process;
               
            }

No comments:

Post a Comment