ALAppExtensions
ALAppExtensions copied to clipboard
table 39 "Purchase Line" - OnValidateNoAfterCopyFromTempPurchLineOnBeforeInitRec
Describe the request
Can you please add the following event to table 39 "Purchase Line"?
Old code:
field(6; "No."; Code[20])
{
CaptionClass = GetCaptionClass(FieldNo("No."));
Caption = 'No.';
TableRelation = if (Type = const(" ")) "Standard Text"
else
if (Type = const("G/L Account"), "System-Created Entry" = const(false)) "G/L Account" where("Direct Posting" = const(true), "Account Type" = const(Posting), Blocked = const(false))
else
if (Type = const("G/L Account"), "System-Created Entry" = const(true)) "G/L Account"
else
if (Type = const("Fixed Asset")) "Fixed Asset"
else
if (Type = const("Charge (Item)")) "Item Charge"
else
if (Type = const(Item), "Document Type" = filter(<> "Credit Memo" & <> "Return Order")) Item where(Blocked = const(false), "Purchasing Blocked" = const(false))
else
if (Type = const(Item), "Document Type" = filter("Credit Memo" | "Return Order")) Item where(Blocked = const(false))
else
if (Type = const("Allocation Account")) "Allocation Account"
else
if (Type = const(Resource)) Resource;
ValidateTableRelation = false;
trigger OnValidate()
var
TempPurchLine: Record "Purchase Line" temporary;
IsHandled: Boolean;
begin
[...]
OnValidateNoOnBeforeInitRec(Rec, xRec, CurrFieldNo);
TempPurchLine := Rec;
Init();
SystemId := TempPurchLine.SystemId;
[...]
end;
}
New code:
field(6; "No."; Code[20])
{
CaptionClass = GetCaptionClass(FieldNo("No."));
Caption = 'No.';
TableRelation = if (Type = const(" ")) "Standard Text"
else
if (Type = const("G/L Account"), "System-Created Entry" = const(false)) "G/L Account" where("Direct Posting" = const(true), "Account Type" = const(Posting), Blocked = const(false))
else
if (Type = const("G/L Account"), "System-Created Entry" = const(true)) "G/L Account"
else
if (Type = const("Fixed Asset")) "Fixed Asset"
else
if (Type = const("Charge (Item)")) "Item Charge"
else
if (Type = const(Item), "Document Type" = filter(<> "Credit Memo" & <> "Return Order")) Item where(Blocked = const(false), "Purchasing Blocked" = const(false))
else
if (Type = const(Item), "Document Type" = filter("Credit Memo" | "Return Order")) Item where(Blocked = const(false))
else
if (Type = const("Allocation Account")) "Allocation Account"
else
if (Type = const(Resource)) Resource;
ValidateTableRelation = false;
trigger OnValidate()
var
TempPurchLine: Record "Purchase Line" temporary;
IsHandled: Boolean;
begin
[...]
OnValidateNoOnBeforeInitRec(Rec, xRec, CurrFieldNo);
TempPurchLine := Rec;
OnValidateNoAfterCopyFromTempPurchLineOnBeforeInitRec(Rec, IsHandled);
if not IsHandled then
Init();
SystemId := TempPurchLine.SystemId;
[...]
end;
}
[IntegrationEvent(false, false)]
local procedure OnValidateNoAfterCopyFromTempPurchLineOnBeforeInitRec(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#496081
Can you please explain why do you need to skip Init() here?
Closed due to inactivity.