Identify the "current" page from a code unit

bknopp
Member Posts: 37
Hi, all - I'm back 
I've recently made a very cool modification to Dimension handling, whereby the user can go to one dimension group and, for values in that dimension "controlling" group, set defaults for two other dimension groups. Then, when the user changes the value in the "controlling" group, the other two dimension group values are set to the corresponding defaults. It's very cool, if I do say so myself, and all the logic is in Code Unit 408 (except for the table and page, of course).
However, there's an issue with that. When the user is in, say, the Purchase Order Subform, editing the detail lines of the PO, the dimension changes don't show until the page is refreshed.
Now, given that the "path" to my logic is Purchase Order Subform -> Purchase Lines table -> Dimension Management code unit, how do I force the Purchase Order Subform to refresh? I tried "CurrPage.Refresh", but NAV told me that CurrPage didn't exist. I don't want to put the call on the Purchase Order Subform, because I'd then have to modify a bunch of other forms as well, AND remember to add the call to any dimension-aware forms that I make.
So here's my question: when a user goes Page -> Table -> Code Unit, is there a way in the Code Unit to identify the page that's a couple of abstraction layers up?

I've recently made a very cool modification to Dimension handling, whereby the user can go to one dimension group and, for values in that dimension "controlling" group, set defaults for two other dimension groups. Then, when the user changes the value in the "controlling" group, the other two dimension group values are set to the corresponding defaults. It's very cool, if I do say so myself, and all the logic is in Code Unit 408 (except for the table and page, of course).
However, there's an issue with that. When the user is in, say, the Purchase Order Subform, editing the detail lines of the PO, the dimension changes don't show until the page is refreshed.
Now, given that the "path" to my logic is Purchase Order Subform -> Purchase Lines table -> Dimension Management code unit, how do I force the Purchase Order Subform to refresh? I tried "CurrPage.Refresh", but NAV told me that CurrPage didn't exist. I don't want to put the call on the Purchase Order Subform, because I'd then have to modify a bunch of other forms as well, AND remember to add the call to any dimension-aware forms that I make.
So here's my question: when a user goes Page -> Table -> Code Unit, is there a way in the Code Unit to identify the page that's a couple of abstraction layers up?
0
Answers
-
0
-
Thanks, ara3n. I'll give that a try this afternoon0
-
I tried that workaround and got error to the effect that I could not create the automation server. I created the WshShell object as an Automation with a subtype of 'Windows Script Host Object Model'.IWshShell3 - that was the only object that made sense in the context of that page.
Any suggestions?
[edit]
I may have omitted a pertinent detail - I'm developing this on a Windows 8 machine, and it has to work on all current Windows platforms.0 -
Not sure. There was also a trick to use xml events and update header and lines.0
-
make sure the object is instantiated on the client and not on the server. there is a property on the variable to change that.0
-
I had a "doh!" moment, but it's working now.
I had created the wrong kind of object - initially I'd created an IWshShell3 object. I needed to create a WshShell object instead (no leading "I" or trailing "3"). Once I set the variable to the correct object, it worked like a charm.
I don't suppose there's a way to suppress that "is it okay to use automation?" dialog, is there?0 -
The warning comes up only once..?0
-
I only saw it once, but when I saw it during my local testing I chose "always allow". I'm not sure what happens when other options are chosen.0
-
once is normal0
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