[Event Request] Events before and after <LedgerEntryTable>.FINDLAST
Greetings - We are migrating an add-on to an extension. Part of the functionality of our add-on enables the setup of dimension-based data restrictions for users (eg. a user can only see data for the ADM department). We do this by filtering FILTERGROUP(1) upon login. This is all fine. Where an issue comes up, is when the user goes to post any transaction. As an example, if the last record in the G/L Entry table is for a different department, the user cannot see it. So, when codeunit 12 does a FINDLAST for the GLEntry variable (to get the last entry no.), it returns the wrong entry no...and the user hits an error that the Entry No. already exists.
In the classic environment, we update all of the FINDLAST calls in codeunits that post to ledger entry tables (G/L Entry, Item Ledger Entry, Value Entry, Job Ledger Entry, etc.) to add code right before FINDLAST to remove the filter in FILTERGROUP(1)...and then code right after it gets the entry number to restore the filter. So, we are looking for events to facilitate this for ALL ledger postings. In codeunit 12, for example, we would need two events added to the InitNextEntryNo function - one at the start (OnInitNextEntryNoStart) and one at the end (OnInitNextEntryNoEnd) that pass the GLEntry variable out so we can modify filters
To be a bit more clear, in the event of codeunit 12, i'd be looking for two integration events to be added to the InitNextEntryNo function, one at the start (OnBeforeInitNextEntryNo) and one after (OnAfterInitNextEntryNo) that pass the GLEntry variable in. Similar for the other posting routines.
EDIT: Sorry, we don't need the GLEntry variable passed to the integration event. Since we're applying filters in FILTERGROUP(1), they're global...so we will just update those filters without the need for a specific variable to apply them to.
We are making good progress at finding ways to workaround limitations or implement our add-on functionality, but this is one that we can't really pull off another way. I'm hoping you can look at it soon and that you'll be willing to add the required events.
This is a pretty critical one for us right now. We have multiple partners with prospects for the cloud that need our add-on including dimension-based security. I tried working with events before and after the various
Hi @RHansenEpimatic , The function COD12.InitNextEntryNo includes a GLEntry record with a special property - [SecurityFiltering(SecurityFilter::Ignored)]. This had been added to resolve a similar problem that occurred when user permission included security filter.
local procedure InitNextEntryNo()
var
[SecurityFiltering(SecurityFilter::Ignored)]
GLEntry: Record "G/L Entry";
If you would consider using security filters we would definitely update all code searching for a next entry number.
Thanks for reporting this. We agree, and we’ll publish a fix asap, either in an update for the current version or in the next major release. We will update this issue with information about availability.