D365 Business Central Extending Deferrals
dborg
Member Posts: 3
Hi All,
I am trying to extended the functionality of Deferrals (Sales Lines table, onValidate of deferral code).
Automatically, when validating deferral code, NAV is creating the Deferral Schedule (in the below screenshot calling "DeferralCodeOnValidate").

In short, I need to update the global variable "DeferralPostDate" before calling the function "DeferralCodeOnValidate" by using some information from the SalesLine record.
There is an event raised "OnGetDeferralPostDate" which I thought would be brilliant, to subscribe to it, update the "DeferralPostDate" and all my troubles will be solved. The thing is, that from my subscriber function, I will not have visibility to the Sales Line record (Rec) which i need for my logic. I cannot subscribe to the OnValidate event (raised by the platform) since I will not have access to the global variable "DeferralPostDate" and unfortunately the raised event "OnGetDeferralPostData" does not give access to global variables.
Obviously I cannot update any base code, as that's the whole point of BC on cloud.
I feel that i'm stuck between a rock and a hard place
Any tips (or comments to correct me) will be greatly appreciated.
Good day ladies and gents
Dave
I am trying to extended the functionality of Deferrals (Sales Lines table, onValidate of deferral code).
Automatically, when validating deferral code, NAV is creating the Deferral Schedule (in the below screenshot calling "DeferralCodeOnValidate").

In short, I need to update the global variable "DeferralPostDate" before calling the function "DeferralCodeOnValidate" by using some information from the SalesLine record.
There is an event raised "OnGetDeferralPostDate" which I thought would be brilliant, to subscribe to it, update the "DeferralPostDate" and all my troubles will be solved. The thing is, that from my subscriber function, I will not have visibility to the Sales Line record (Rec) which i need for my logic. I cannot subscribe to the OnValidate event (raised by the platform) since I will not have access to the global variable "DeferralPostDate" and unfortunately the raised event "OnGetDeferralPostData" does not give access to global variables.
Obviously I cannot update any base code, as that's the whole point of BC on cloud.
I feel that i'm stuck between a rock and a hard place
Good day ladies and gents
Dave
0
Comments
-
You’re hitting a normal BC limitation. that event doesn’t give enough context (no Sales Line), and you can’t access the global variable.
Best approach:
- Set your logic before deferral runs. use Sales Line events like OnValidate of Deferral Code
- Pre-calculate what you need, then let standard logic continue
- If needed, store values in a custom field on Sales Line and use that
You can’t safely change it inside
DeferralCodeOnValidate, so prepare the data earlier instead0
Categories
- All Categories
- 75 General
- 75 Announcements
- 66.7K Microsoft Dynamics NAV
- 18.8K 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
- 610 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 253 Dynamics CRM
- 103 Dynamics GP
- 6 Dynamics SL
- 1.5K Other
- 991 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 28 Design Patterns (General & Best Practices)
- Architectural Patterns
- 9 Design Patterns
- 4 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1K General Chat
- 1.6K Website
- 77 Testing
- 1.2K Download section
- 23 How Tos section
- 249 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions