NAV 2017 Action Events - CurrPage.UPDATE

wittgenstein
Member Posts: 17
Hi all,
I'm currently creating an Extension/App (upgrading an older solution). I added some page actions and created a Codeunit to handle the action events (OnBeforeActionEvent).
Is it possible to update the action calling page like it is in the action trigger of the page itself (-> CurrPage.UPDATE)? If not, maybe there is a work-around you know about?!
Thanks in advance.
I'm currently creating an Extension/App (upgrading an older solution). I added some page actions and created a Codeunit to handle the action events (OnBeforeActionEvent).
Is it possible to update the action calling page like it is in the action trigger of the page itself (-> CurrPage.UPDATE)? If not, maybe there is a work-around you know about?!
Thanks in advance.
0
Best Answer
-
OK I had an idea for a workaround. And it worked. It's not best practice but I made a few test scenarios and there were no errors.
I just used SendKeys to send an 'F5' to the page. I used the DotNet solution as there is a popup when running an Automation for the first time.0
Answers
-
Unfortunately this is not possible because NAV doesn't pass the Page object to the event. I had a similar issue in that I wanted to make the page editable/non-editable via the OnOpenPageEvent() event - but without having a reference to the page itself - its not possible.
I don't know of a work-around for this either.0 -
Hi,
that's sad news. I was hoping I missed something in the whole event thingy. Really unfortunate.
Thanks for your answer anyway :-)0 -
Unfortunately this is not possible because NAV doesn't pass the Page object to the event. I had a similar issue in that I wanted to make the page editable/non-editable via the OnOpenPageEvent() event - but without having a reference to the page itself - its not possible.
I don't know of a work-around for this either.
@Kishorm to make page editable / non editable what you can do is to set a boolean variable on Editable property and make it true on OnInitPage() depend on some condition.
Moreover you can also call one page function to another but make sure function should not be LOCAL. By calling that function you can set the value of that boolean variable.Best Regards
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.0 -
@wittgenstein can you please elaborate more what you are trying to do? may be i can suggest you some work around?Best Regards
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.0 -
Unfortunately this is not possible because NAV doesn't pass the Page object to the event. I had a similar issue in that I wanted to make the page editable/non-editable via the OnOpenPageEvent() event - but without having a reference to the page itself - its not possible.
I don't know of a work-around for this either.
@Kishorm to make page editable / non editable what you can do is to set a boolean variable on Editable property and make it true on OnInitPage() depend on some condition.
Moreover you can also call one page function to another but make sure function should not be LOCAL. By calling that function you can set the value of that boolean variable.
@zohaibu95 You're misunderstanding this post. I know how to set the Editable property on a Page - that's not what this is about. It's about how to achieve this by using Events in separate codeunits - i.e. WITHOUT changing the Page object itself.1 -
ah, this is not possible as far as i know.Best Regards
Zohaib Ahmed
Dynamics NAV ERP Technical Consultant.
please like / agree / verify my answer, if it was helpful for you. thanks.0 -
@wittgenstein can you please elaborate more what you are trying to do? may be i can suggest you some work around?
@wittgenstein wants to add a new Action to a Page and within this action he wants to call the CurrPage.UPDATE to update the Page. However he wants to achieve this without making any changes to the Page object itself but by using Events mechanism introduced in NAV 2016.0 -
@wittgenstein wants to add a new Action to a Page and within this action he wants to call the CurrPage.UPDATE to update the Page. However he wants to achieve this without making any changes to the Page object itself but by using Events mechanism introduced in NAV 2016.
That's exactly what I want. Even though it is possible in extensions to add new actions you can't add code to the actions' triggers. This is why I wanted to solve this with events.
So I chose the OnBeforeActionEvent and added my code. Unfortunately NAV doesn't pass the page object to the event so you are not able to make an update (CurrPage.UPDATE) on the page.0 -
this is one of the limitations extensions1.0
we need to wait for extensions 2.0 which is in preview1 -
OK I had an idea for a workaround. And it worked. It's not best practice but I made a few test scenarios and there were no errors.
I just used SendKeys to send an 'F5' to the page. I used the DotNet solution as there is a popup when running an Automation for the first time.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