ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

[Event Request] Events before and after <LedgerEntryTable>.FINDLAST

Open RHansenEpimatic opened this issue 7 years ago • 5 comments

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

RHansenEpimatic avatar Feb 19 '19 19:02 RHansenEpimatic

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.

RHansenEpimatic avatar Mar 01 '19 18:03 RHansenEpimatic

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.

RHansenEpimatic avatar Mar 04 '19 18:03 RHansenEpimatic

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 .FINDLAST calls...but there's too much logic between them. We really need events right before and after. This includes all "Entry" tables really...G/L Entry...Item Ledger Entry...Check Ledger Entry...Budget Entry (that one is flowfield driven so it could be a real problem)...Bank Account Ledger Entry...etc. etc. etc.

RHansenEpimatic avatar Mar 06 '19 22:03 RHansenEpimatic

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.

StanPesotskiy avatar Nov 07 '19 06:11 StanPesotskiy

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.

bc-ghost avatar Nov 25 '19 08:11 bc-ghost