-
Notifications
You must be signed in to change notification settings - Fork 688
Description
Why do you need this change?
Please add an event publisher before the standard TestField(Blocked, false) and TestField(Inactive, false) calls in the PostBudgetAsset procedure of codeunit 5632 "FA Jnl.-Post Line". The event should include an IsHandled flag so extensions can skip the standard blocked/inactive checks and implement custom logic for budgeted asset posting, mirroring the extensibility already available in the PostFixedAsset procedure.
Alternatives Evaluated:
We have reviewed all existing events in codeunit 5632, including OnBeforePostBudgetAsset and OnPostBudgetAssetOnBeforeInsertFAEntry. However, these events are either too early (before the FA record is retrieved) or too late (after the testfield checks have already executed). There is no event that allows us to conditionally bypass the standard Blocked/Inactive checks for specific business scenarios, as is possible in PostFixedAsset. Therefore, a new event at this location is required.
Justification for IsHandled:
We need to use IsHandled because, without it, the standard code would always execute the blocked/inactive checks, which may conflict with custom business processes or regulatory requirements. The IsHandled pattern is the only way to allow a subscriber to fully replace or bypass this logic, as is already supported in the PostFixedAsset procedure. Without IsHandled, we would be forced to duplicate or override standard logic, which is not supported and would break on upgrades.
Performance Considerations:
This event is triggered only when budgeted asset posting is performed, which is a relatively infrequent operation compared to general journal posting. The event will only be triggered in these specific scenarios, and the IsHandled pattern is already used elsewhere in this codeunit without measurable performance impact. The additional event will not introduce any significant overhead.
Data Sensitivity Review:
The event exposes only the current FA Ledger Entry and BudgetNo, which do not contain sensitive personal data. These parameters are already available in other event publishers within this codeunit and object. There are no new data exposure concerns.
Multi Extension Interaction:
Extensions that rely on this event must coordinate via dependency declarations. Partners can use EventSubscriberInstance = Manual to control execution order. The pattern is consistent with other core IsHandled events, so developers are familiar with the implications.
Example of our custom code:
[EventSubscriber(ObjectType::Codeunit, Codeunit::"FA Jnl.-Post Line", 'OnPostFixedAssetOnBeforeFixedAssetTestField', '', false, false)]
local procedure FAJnlPostLine_OnPostFixedAssetOnBeforeFixedAssetTestField(var FALedgerEntry: Record "FA Ledger Entry"; Amount2: Decimal; var IsHandled: Boolean)
var
FA: Record "Fixed Asset";
CustMgt: Codeunit "HKR Cust. Mgt";
begin
// Custom logic: allow posting for inactive FA under certain conditions
if CustMgt.CheckPostAcquisOnIanctiveFA(FALedgerEntry) then begin
FA.Get(FALedgerEntry."FA No.");
FA.TestField(Blocked, false); // Only check Blocked, skip Inactive
IsHandled := true; // Skip standard Blocked/Inactive checks in base app
end;
// Otherwise, IsHandled remains false and both Blocked and Inactive checks run
end;Describe the request
Please add a new event publisher before the standard blocked/inactive checks in the PostBudgetAsset procedure of codeunit 5632 "FA Jnl.-Post Line". The publisher should include an IsHandled parameter so extensions can override this logic and implement custom validation or bypass the checks as needed.
For reference, the PostFixedAsset procedure already implements this pattern as follows:
FA.Get(FANo);
IsHandled := false;
OnPostFixedAssetOnBeforeFixedAssetTestField(FALedgEntry, Amount2, IsHandled);
if not IsHandled then begin
FA.TestField(Blocked, false);
FA.TestField(Inactive, false);
end; We request that the same structure be applied in PostBudgetAsset, with a new event:
FA2.Get(BudgetNo);
IsHandled := false;
OnPostBudgetAssetOnBeforeFixedAssetTestField(FALedgEntry, BudgetNo, IsHandled);
if not IsHandled then begin
FA2.TestField(Blocked, false);
FA2.TestField(Inactive, false);
end;The event signature should be:
[IntegrationEvent(false, false)]
local procedure OnPostBudgetAssetOnBeforeFixedAssetTestField(var FALedgEntry: Record "FA Ledger Entry"; BudgetNo: Code[20]; var IsHandled: Boolean)
begin
end;This change will provide a consistent and flexible extensibility point for both standard and budgeted asset postings, enabling partners to implement custom logic as needed.
Internal work item: AB#622826