AL icon indicating copy to clipboard operation
AL copied to clipboard

OnInsertRecord and OnModifyRecord

Open Avanti05 opened this issue 9 years ago • 5 comments

Is it deliberate that the OnInsertRecord and OnModifyRecord triggers is not working on pages? OnInsertRecord results in a message saying that the view is filtered and the record is outside the filter. (Even though there are no filters set on the page..)

OnModifyRecord simply causes that you are unable to modify the record..

Avanti05 avatar Aug 22 '17 06:08 Avanti05

Can you give an example of AL code that causes these issues? The triggers on pages should work exactly the same as before

StanislawStempin avatar Aug 23 '17 13:08 StanislawStempin

No code actually..

trigger OnInsertRecord(BelowxRec : Boolean) : Boolean; begin

end;

trigger OnModifyRecord() : Boolean; begin

end;

Just the triggers it seems..

Avanti05 avatar Aug 23 '17 14:08 Avanti05

Have you tried returning true from the triggers? Returning default/false means you're telling the system not to modify or insert any records. See the documentation on MSDN: https://msdn.microsoft.com/en-us/library/dd301145(v=nav.90).aspx https://msdn.microsoft.com/en-us/library/dd338973(v=nav.90).aspx

StanislawStempin avatar Sep 11 '17 15:09 StanislawStempin

I'm having the same issues

simple table

table 50115 "Trigger Test" {
    fields {
        field(1; "Code"; Code[10]) {}
    }
    keys {
        key("Primary Key"; Code) {}
    }
    trigger OnInsert();
    begin
        message('bar');
    end;
}

simple page

page 50115 "Trigger Test" {
    SourceTable = "Trigger Test";
    PageType = List;

    layout {
        area(Content) {
            repeater("General") {
                field("Entry No.";Code) {}
            }
        }
    }
    trigger OnInsertRecord(BelowxRec : Boolean) : Boolean;
    begin
        message('foo');
    end;
}

As soon as there is an OnInsertRecord trigger on the page, i receive the message the record is outside of the filter, and my OnInsert trigger from the table is not executed.

@StanislawStempin An "exit(true)" in the OnInsertTrigger does indeed prevent at least the error message, but the table trigger is still not executed!

Walwode avatar Nov 20 '17 11:11 Walwode

Thanks for providing the repro. We will look into it.

StanislawStempin avatar Nov 22 '17 23:11 StanislawStempin