BC Security Filter

Hi there,

I have an issue with Security Filter in BC if I want to set Security Filter on the No. Series tables. Let’s say I have 2 different prefix for Sales Order, when I set the Security Filter, the system always show this message “A security filter has been applied to table No. Series. You cannot access records that are outside of this filter.”

I debug and it break on code below in function “CheckNumberSeries” (codeunit 1400) :
IF RecVariant.ISRECORD AND (NoSeriesCode <> ‘’) AND NoSeries.GET(NoSeriesCode) THEN BEGIN

In NAV, I will add code like below.
NoSeries.SecurityFiltering := SecurityFilter::Ignored; //my additional code
IF RecVariant.ISRECORD AND (NoSeriesCode <> ‘’) AND NoSeries.GET(NoSeriesCode) THEN BEGIN

How to do this using extension with AL Code in Business Central?
in extension, I cannot add code because there is no publisher before the system Get the NumberSeries.

Any suggestions are welcome, what I need is to restrict user to choose inappropriate Nos. (Usually I need it for my customer with many branches, so that each branch will have their own prefix number)

Thank you.

Hi Olwin,

I do not have the solution for you, but I would suggest that you go to microsoft/ALAppExtensions: Repository for collaboration on Microsoft AL application add-on and localization extensions for Microsoft Dynamics 365 Business Central. (github.com) and creates a request for a new integration event.

Perhaps not an exact solution, but it may give you some ideas. A few years back (NAV 2016), we had a client that needed to set the Number Series on Purchase Orders based on the selection of a custom “Order Type” field. They did not want to rely on the users manually picking the correct Number Series. Too much potential for downstream business problems.

The solution was to use the “Purchase Header - OnBeforeInsert” event to prompt the user for the “Order Type”. Then use that to set the "Number Series’ and assign the “Document No.”. The idea was to have the “Document No.” assigned before the standard number series logic executed. Thus the only check it did was to verify manual numbering was allowed.

Disclaimer: Being NAV 2016 this was the first version with events. I’d say we were all learning at that point. While the bulk of this solution was event-based, I can’t say with 100% accuracy that there was no inline code.

Hope this provides some help.