Programmatically activating custom views

co_net
Member Posts: 2
I've defined a couple of views in my PageExtension like the example below. Is there a way to activate a view from (for example) an OnDrillDown trigger that uses Page.Run(...) to open the page with the custom views?
views { addlast { view(Invoicing) { Caption = 'Invoicing'; Visible = true; SharedLayout = false; OrderBy = descending(...); Filters = where(...); layout { // hide modify("Opportunity No.") { Visible = false; } // show modify("Bill-to Customer No.") { Visible = true; } modify("Bill-to Name") { Visible = true; } } } }
0
Answers
-
I dont know if that would work with BC, but the old way could be something like this:
Create a function on your page like:SetVisibility(xOpportunityNo, xBilltoCustomerNo, xBilltoName) [all beeing booleans] gOpportunityNo := xOpportunityNo; gBilltoCustomerNo := xBilltoCustomerNo; gBilltoName := xBilltoName;
Then calling the page OnDrillDown with:PageVar.SetVisibility(false, true, true); PageVar.Run;
It's not the fanciest code but worked for me before.
And i hope it works in AL!
0 -
Yeah i did something like this already as a temporarily hack, so in the page the correct columns/filters are set. But the custom view is not selected/bold, so still a bit unclear for the user this view is now active.
I hoped for something to do CurrPage.ActivateView() or <viewname>.Enable, but i cant find anything like this.0 -
Well, there is the option to set the same variable as enabled too.
Also there is the property "AccessByPermission" but I haven't used this for just a field. So I dont know if it will hide it definitely or just pop an error when the user open the page.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions