AL icon indicating copy to clipboard operation
AL copied to clipboard

error AL0132: 'Record "Purchase Price"' does not contain a definition for 'SystemId'

Open stijn9830 opened this issue 6 years ago • 5 comments

Hi, i'm trying to compare my Purchase Price record by systemid in an extension and I'm getting this error: error AL0132: 'Record "Purchase Price"' does not contain a definition for 'SystemId'

When I look in the table, this Purchase Price record contains a SytemId when I compile --> no problem but when I publish I'm getting this error.

Am I Comparing the wrong way?

image

stijn9830 avatar Jun 11 '20 10:06 stijn9830

Can you provide a sample that reproduces the issue instead of a screenshot?

atoader avatar Jun 12 '20 09:06 atoader

Hi

[EventSubscriber(ObjectType::Table, Database::"Purchase Price", 'OnAfterValidateEvent', 'Direct Unit Cost', true, true)]
local procedure OnAfterValidatePurchasePriceUnitCost(var Rec: Record "Purchase Price")
var
    PurchasePrice: Record "Purchase Price";

begin
    if rec.IsTemporary then
        exit;

    PurchasePrice.SetRange("Vendor No.", Rec."Vendor No.");
    PurchasePrice.SetRange("Item No.", Rec."Item No.");
    PurchasePrice.SetRange("Variant Code", Rec."Variant Code");
    PurchasePrice.SetFilter("Starting Date", '< %1', Today);
    PurchasePrice.SetFilter("Ending Date", '> %1', Today);
    if PurchasePrice.FindFirst() then
        if PurchasePrice.SystemId = Rec.SystemId then
            ChangeLastUnitCost(PurchasePrice."Item No.", Rec."Direct Unit Cost")
        else
            ChangeLastUnitCost(PurchasePrice."Item No.", PurchasePrice."Direct Unit Cost")
    else begin
        PurchasePrice.SetFilter("Ending Date", '= %1', 0D);
        if PurchasePrice.FindFirst() then
            if PurchasePrice.SystemId = Rec.SystemId then
                ChangeLastUnitCost(PurchasePrice."Item No.", Rec."Direct Unit Cost")
            else
                ChangeLastUnitCost(PurchasePrice."Item No.", PurchasePrice."Direct Unit Cost")
    end;

end;

stijn9830 avatar Jun 12 '20 09:06 stijn9830

I must mention this is on 14.5 BC version

stijn9830 avatar Jun 12 '20 09:06 stijn9830

SystemId was introduced in version 15.0. Should we close this issue?

atoader avatar Jun 12 '20 09:06 atoader

ok, then I will have to find a workaround. sorry for the trouble

stijn9830 avatar Jun 12 '20 09:06 stijn9830