microsoft / microsoft/BCApps

[ES][Table][8063][Vendor Subscription Contract] Add OnBeforeUpdateAllLineDim event

Open Beginner friendly
#10,886 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Approved event-request ext-ready-to-implement Team: Finance
Dominant language
AL
Stars
683
Forks
459
Avg merge
3d 26m
Merged PRs (30d)
633

Description

Why do you need this change?

I need an event similar to the one available in table "Customer Subscription Contract" so that I can execute custom code whenever dimensions are changed on the header, before they are updated on the lines.

Describe the request

In table 8063 "Vendor Subscription Contract", within the UpdateAllLineDim function, I need an event to be published, OnBeforeUpdateAllLineDim(Rec, NewParentDimSetID, OldParentDimSetID, IsHandled, xRec), immediately before the call to if IsHandled then exit.

This event is required so that execute custom code whenever dimensions are changed on the header, before they are updated on the lines.

local procedure UpdateAllLineDim(NewParentDimSetID: Integer; OldParentDimSetID: Integer)
var
    ServiceCommitment: Record "Subscription Line";
    NewDimSetID: Integer;
    IsHandled: Boolean;
begin
    IsHandled := false;
    OnBeforeUpdateAllLineDim(Rec, NewParentDimSetID, OldParentDimSetID, IsHandled, xRec);
    if IsHandled then
        exit;
  • Alternatives evaluated: I can't find any other centralized place to detect that the header dimensions have been changed and are about to be propagated to the lines. In many cases, the "Dimension Set ID" field is updated without using VALIDATE, so the field trigger is not sufficient. The OnModify trigger does not work either because, in some scenarios, the original xRec value has already been lost.
    I only want to execute my custom code when one or more dimensions on the header have actually changed, before those changes are applied to the lines.
    The event does exist on the customer contract header table, so I believe it makes perfect sense to add the same event to the vendor contract header table as well.

  • Justification for IsHandled: The IsHandled parameter is not strictly necessary, but it is commonly used in OnBefore events that are raised from functions following the standard IsHandled pattern.

  • Performance considerations: I do not see any performance issue here. The standard UpdateAllDim function is called to update the dimensions of the lines when dimensions are updated on the header, and that behavior remains unchanged. What our code will do is populate a change log with the dimensions modified on the header and set a flag in a SingleInstance codeunit to indicate that any subsequent line updates are the result of a dimension change on the header.
    Many standard functionalities include OnBefore events, and this would simply be another example of that pattern. If there is no issue with the existing event on the Customer Contract Header, I do not see any reason why the same event should not be added to the Vendor Contract Header as well.

  • Data sensitivity review: Based on everything explained above, I do not see anything else that needs to be addressed on this point.

  • Multi-extension interaction: The risks are the same as with any other OnBefore event that already exists in the standard codebase. There is nothing inherently different about this event compared to the many other OnBefore events available throughout the application.
    If the existing event on the Customer Contract Header has not introduced any issues, I do not see any additional risk in providing an equivalent event on the Vendor Contract Header. The event would simply offer an extension point for customizations prior to the standard processing, following the same pattern that is already widely used in the standard application.

  • xRec justification: It doesn't really need the xRec. The reason I suggested keeping it the same as in customer contracts is simply because I think that's the best approach when it performs the same function, but in practice the xRec isn't actually required.

Provide an implementation (optional)
  • I will provide the implementation for this extensibility request

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Find table 8063, "Vendor Subscription Contract", and inspect its UpdateAllLineDim function. Compare the corresponding event in the "Customer Subscription Contract" table, then confirm the requested event parameters and placement immediately before the existing IsHandled exit. Done means the vendor table exposes the equivalent extension point without changing standard dimension propagation.

Written by the indexing model from the issue text.

Assessment

Domain
backend-api-design
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
74/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.