Page OnAfterActionEvent not refreshing page

rcverbeek
Member Posts: 32
Hi,
We are in the middle of migrating from C/AL to AL. As a first step we are replacing as much custom code with events.
Now I am working on a page with a custom action. The code beind is:
Now obiously, the CurrPage.UPDATE can not be used inside an event function. However, I was kind of hoping that after firing an OnAfterActionEvent event, Dynamics Nav would trigger the CurrPage.UPDATE itself. This would make sense since the Rec is passed as a VAR parameter. However, I have tested it and no CurrPage.UPDATE is triggered.
Does anyone has an idea how to go about this? And would you agree that Dynamics Nav (BC) should issue a CurrPage.UPDATE?
We are on Business Central 2018 CU3.
Thanks!
We are in the middle of migrating from C/AL to AL. As a first step we are replacing as much custom code with events.
Now I am working on a page with a custom action. The code beind is:
- Execute a Function in a Codeunit, Rec is passed as VAR
- This codeunit changes the Rec
- CurrPage.UPDATE, changes are reflected on the page
Now obiously, the CurrPage.UPDATE can not be used inside an event function. However, I was kind of hoping that after firing an OnAfterActionEvent event, Dynamics Nav would trigger the CurrPage.UPDATE itself. This would make sense since the Rec is passed as a VAR parameter. However, I have tested it and no CurrPage.UPDATE is triggered.
Does anyone has an idea how to go about this? And would you agree that Dynamics Nav (BC) should issue a CurrPage.UPDATE?
We are on Business Central 2018 CU3.
Thanks!
0
Answers
-
I disagree that NAV/BC should automatically call CurrPage.Update(true/false), because then you wouldn't have control over it.
Anyway, if I understand correctly, you have something like this:
And the problem being that you cannot call CurrPage.Update(true/false), because you're not on the Page, but in a separate codeunit.
But you can also "hook up" to Page Actions (before and after execution) on the page level, by modifying the required action, and adding trigger OnAfterAction or OnBeforeAction:
You put your code there, and you don't need an Event Subscriber at all!
0 -
Hi ShaiHulud,
Thanks for your time and answer!
At the moment we don't have any AL code yet. We first want to decrease our custom C/AL code by introducing events. When we are done we can convert out C/AL to AL.
I was hoping to be able to force a page refresh, in order to reduce the amount of custom AL code. But apperantly this is not possible.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