BC Idea Link
NA
Description
We have noticed that before moving number series code to Business foundation application codeunit 396 NoSeriesManagement had more events that we could subscribe to.
For example
procedure GetNextNo(NoSeriesCode: Code[20]; SeriesDate: Date; ModifySeries: Boolean) Result: Code[20]
var
IsHandled: Boolean;
begin
IsHandled := false;
OnBeforeGetNextNo(NoSeriesCode, SeriesDate, ModifySeries, Result, IsHandled, LastNoSeriesLine);
if IsHandled then
exit(Result);
exit(DoGetNextNo(NoSeriesCode, SeriesDate, ModifySeries, false));
end;
Current codeunits 310 "No. Series" and 304 "No. Series - Impl." has way less integration events which we might have used if codeunit 396 NoSeriesManagement existed.
We need new events to support scenarios where, for specific NoSeriesCode values, custom logic must be applied to modify or enrich related records (e.g., setting additional custom fields) during number assignment. Without an early integration event, there is no way to intercept the process before standard logic executes and ensure that required custom field updates are applied consistently.
For our solution we need 3 new integration events on codeunit 310 "No. Series" which could be used on codeunit 304 "No. Series - Impl."
1.
Integration events on codeunit 310 "No. Series"
[IntegrationEvent(false, false)]
internal procedure OnBeforeGetNextNo(var NoSeriesLine: Record "No. Series Line"; NoSeriesCode: Code[20]);
begin
end;
[IntegrationEvent(false, false)]
internal procedure OnAfterGetNextNo(var NoSeriesLine: Record "No. Series Line"; NoSeriesCode: Code[20]);
begin
end;
Event used on codeunit 304 "No. Series - Impl."
procedure GetNextNo(NoSeriesCode: Code[20]; SeriesDate: Date; HideErrorsAndWarnings: Boolean): Code[20]
var
NoSeriesLine: Record "No. Series Line";
NoSeries: Codeunit "No. Series"; //New local variable
Result: Code[20];
begin
NoSeries.OnBeforeGetNextNo(NoSeriesLine, NoSeriesCode); //New event
if not GetNoSeriesLine(NoSeriesLine, NoSeriesCode, SeriesDate, HideErrorsAndWarnings) then
exit('');
//exit(GetNextNo(NoSeriesLine, SeriesDate, HideErrorsAndWarnings)); //Commented standard line
Result := GetNextNo(NoSeriesLine, SeriesDate, HideErrorsAndWarnings);
NoSeries.OnAfterGetNextNo(NoSeriesLine, NoSeriesCode); //New event
exit(Result);
end;
2.
Integration event on codeunit 310 "No. Series"
[IntegrationEvent(false, false)]
internal procedure OnGetNoSeriesRec(var NoSeriesRec: Record "No. Series"; NoSeriesCode: Code[20]);
begin
end;
[InherentPermissions(PermissionObjectType::TableData, Database::"No. Series Line", 'm')]
procedure GetNoSeriesLine(var NoSeriesLine: Record "No. Series Line"; NoSeriesCode: Code[20]; UsageDate: Date; HideErrorsAndWarnings: Boolean): Boolean
var
NoSeriesRec: Record "No. Series";
NoSeriesLine2: Record "No. Series Line";
NoSeries: Codeunit "No. Series";
NoSeriesSetupImpl: Codeunit "No. Series - Setup Impl.";
NoSeriesErrorsImpl: Codeunit "No. Series - Errors Impl.";
LineFound: Boolean;
NoSeries: Codeunit "No. Series"; //New local variable
begin
...
// If Date Order is required for this No. Series, make sure the usage date is not before the last date used
NoSeriesRec.SetLoadFields(Code, "Date Order");
NoSeriesRec.Get(NoSeriesCode);
NoSeries.OnGetNoSeriesRec(NoSeriesRec, NoSeriesCode); //New event
if NoSeriesRec."Date Order" and (UsageDate < NoSeriesLine."Last Date Used") then begin
if HideErrorsAndWarnings then
exit(false);
NoSeriesErrorsImpl.Throw(StrSubstNo(CannotAssignNewBeforeDateErr, NoSeriesRec.Code, NoSeriesLine."Last Date Used"), NoSeriesLine, NoSeriesErrorsImpl.OpenNoSeriesLinesAction());
end;
exit(true);
end;
I will provide the implementation for this BC Idea
BC Idea Link
NA
Description
We have noticed that before moving number series code to Business foundation application codeunit 396 NoSeriesManagement had more events that we could subscribe to.
For example
Current codeunits 310 "No. Series" and 304 "No. Series - Impl." has way less integration events which we might have used if codeunit 396 NoSeriesManagement existed.
We need new events to support scenarios where, for specific NoSeriesCode values, custom logic must be applied to modify or enrich related records (e.g., setting additional custom fields) during number assignment. Without an early integration event, there is no way to intercept the process before standard logic executes and ensure that required custom field updates are applied consistently.
For our solution we need 3 new integration events on codeunit 310 "No. Series" which could be used on codeunit 304 "No. Series - Impl."
1.
Integration events on codeunit 310 "No. Series"
Event used on codeunit 304 "No. Series - Impl."
2.
Integration event on codeunit 310 "No. Series"
I will provide the implementation for this BC Idea