ALAppExtensions icon indicating copy to clipboard operation
ALAppExtensions copied to clipboard

table 39 "Purchase Line" - OnValidateTypeAfterCopyFromTempPurchLineOnBeforeInitRec

Open domingosbarreto opened this issue 2 years ago • 2 comments

Describe the request

Can you please add the following event to table 39 "Purchase Line"?

Old code:

        field(5; Type; Enum "Purchase Line Type")
        {
            Caption = 'Type';

            trigger OnValidate()
            var
                TempPurchLine: Record "Purchase Line" temporary;
                IsHandled: Boolean;
            begin
                
                [...]
                
                OnValidateTypeOnBeforeInitRec(Rec, xRec, CurrFieldNo);
                TempPurchLine := Rec;
                Init();
                SystemId := TempPurchLine.SystemId;

                [...]
                
            end;
        }

New code:

        field(5; Type; Enum "Purchase Line Type")
        {
            Caption = 'Type';

            trigger OnValidate()
            var
                TempPurchLine: Record "Purchase Line" temporary;
                IsHandled: Boolean;
            begin
                
                [...]
                
                OnValidateTypeOnBeforeInitRec(Rec, xRec, CurrFieldNo);
                TempPurchLine := Rec;
                OnValidateTypeAfterCopyFromTempPurchLineOnBeforeInitRec(Rec, IsHandled);
                if not IsHandled then
                    Init();
                SystemId := TempPurchLine.SystemId;

                [...]
                
            end;
        }

    [IntegrationEvent(false, false)]
    local procedure OnValidateTypeAfterCopyFromTempPurchLineOnBeforeInitRec(var PurchaseLine: Record "Purchase Line"; var IsHandled: Boolean)
    begin
    end;

Additional context

In some cases there is the need to stop the record initialization. Internal work item: AB#496079

domingosbarreto avatar Jan 08 '24 14:01 domingosbarreto

Can you explain why do you need to skip Init() statement here?

AlexanderYakunin avatar Jan 16 '24 18:01 AlexanderYakunin

Closed due to inactivity.

tomasevicst avatar Apr 08 '24 12:04 tomasevicst