Skip to content

[Event Request] Table Assembly Header - OnUpdateDescriptionsFromItem and OnUpdateDescriptionsFromVariantCode #29545

@CrematoRina

Description

@CrematoRina

Why do you need this change?

In order to be able to transfer additional description field from Item or Variant to Assembly header, additional integration events are needed.

Descriptions From Item

in function SetDescriptionsFromItem() add event OnUpdateDescriptionsFromItem:

local procedure SetDescriptionsFromItem()
    begin
        GetItem();
        Description := Item.Description;
        "Description 2" := Item."Description 2";
/// Change Start
        OnUpdateDescriptionsFromItem(Rec,Item);
/// Change End
    end;

integration event

    [IntegrationEvent(false, false)]
    local procedure OnUpdateDescriptionsFromItem(var AssemblyHeader: Record "Assembly Header"; Item: Record Item)
    begin
    end;

Descriptions from Variant Code

In OnValidate trigger for "Variant Code" field add event OnUpdateDescriptionsFromVariantCode:

field(12; "Variant Code"; Code[10])
        {
            Caption = 'Variant Code';
            TableRelation = "Item Variant".Code where("Item No." = field("Item No."),
                                                       Code = field("Variant Code"));

            trigger OnValidate()
            var
                ItemVariant: Record "Item Variant";
                IsHandled: Boolean;
            begin
                CheckIsNotAsmToOrder();
                TestStatusOpen();
                SetCurrentFieldNum(FieldNo("Variant Code"));
                if Rec."Variant Code" = '' then
                    SetDescriptionsFromItem()
                else begin
                    ItemVariant.SetLoadFields(Description, "Description 2", Blocked);
                    ItemVariant.Get("Item No.", "Variant Code");
                    ItemVariant.TestField(Blocked, false);
                    Description := ItemVariant.Description;
                    "Description 2" := ItemVariant."Description 2";
/// Change Start
                    OnUpdateDescriptionsFromVariantCode(Rec,ItemVariant);
/// Change End
                end;
                IsHandled := false;
                OnValidateVariantCodeOnBeforeValidateDates(Rec, xRec, IsHandled);
                if not IsHandled then
                    ValidateDates(FieldNo("Due Date"), true);

                IsHandled := false;
                OnValidateVariantCodeOnBeforeUpdateAssemblyLines(Rec, xRec, CurrFieldNo, CurrentFieldNum, IsHandled);
                if not IsHandled then
                    AssemblyLineMgt.UpdateAssemblyLines(Rec, xRec, FieldNo("Variant Code"), false, CurrFieldNo, CurrentFieldNum);
                AssemblyHeaderReserve.VerifyChange(Rec, xRec);
                GetDefaultBin();
                Validate("Unit Cost", GetUnitCost());
                ClearCurrentFieldNum(FieldNo("Variant Code"));
            end;
        }

integration event

    [IntegrationEvent(false, false)]
    local procedure OnUpdateDescriptionsFromVariantCode(var AssemblyHeader: Record "Assembly Header"; ItemVariant: Record "Item Variant")
    begin
    end;

Describe the request

In our product for the Items and Variants we have additional description field witch need to be transferred to Assembly Header.
Internal work item: AB#617063

Metadata

Metadata

Assignees

No one assigned

    Labels

    SCMGitHub request for SCM areaevent-requestRequest for adding an event

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions