Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

page trigger OnInsertRecord does not work as before #7878

Open
3 tasks done
AlexCeg opened this issue Oct 22, 2024 · 4 comments
Open
3 tasks done

page trigger OnInsertRecord does not work as before #7878

AlexCeg opened this issue Oct 22, 2024 · 4 comments

Comments

@AlexCeg
Copy link

AlexCeg commented Oct 22, 2024

Please include the following with each issue:

1. Describe the bug
I have an extension that inserts a record in the OnInsertTrigger of a page extension and returns false in this trigger. This does not work in BC25. The return ist ignored

2. To Reproduce

  1. Go to a sales order and try to insert a line. It works in BC24 and it does not work in BC25.
pageextension 50106 "EXT" extends "Sales Order Subform"
{
    trigger OnInsertRecord(BelowxRec: Boolean): Boolean
    begin
        if CheckFeatureActive() then begin
            Rec.Insert();
            exit(false);
        end else
            exit(true);
    end;

    local procedure CheckFeatureActive(): Boolean
    begin
        exit(true); // e.g. check some setup
    end;
}

3. Expected behavior
There should be no change.

4. Actual behavior
An error occurrs which is quite dangerous when we bring our customers to BC25 because they are not able to create sales orders any more.

5. Versions:

  • AL Language: v14.1.1180850
  • Business Central: 25.0.23364.25738/de
  • Version: 1.94.2 (user setup)
  • Commit: 384ff7382de624fb94dbaf6da11977bba1ecd427
  • Date: 2024-10-09T16:08:44.566Z
  • Electron: 30.5.1
  • ElectronBuildId: 10262041
  • Chromium: 124.0.6367.243
  • Node.js: 20.16.0
  • V8: 12.4.254.20-electron.0
  • OS: Windows_NT x64 10.0.19045

Final Checklist

Please remember to do the following:

  • Search the issue repository to ensure you are reporting a new issue

  • Reproduce the issue after disabling all extensions except the AL Language extension

  • Simplify your code around the issue to better isolate the problem

@dannoe
Copy link

dannoe commented Oct 23, 2024

The return value already handles if the insert should happen. Why do you call Rec.insert and return false?
If you want to insert the record, just return true and if not, return false inside the trigger.

@AlexCeg
Copy link
Author

AlexCeg commented Oct 28, 2024

@dannoe It is just an easy example. If I insert the record return false I get an error because the return value is ignored and the standard tries to insert the record as well.

@JohnnyUndercover
Copy link

@AlexCeg I tried your code in a cloud sandbox with Version: DE Business Central 25.0 (Plattform 25.0.26191.0 + Anwendung 25.0.23364.24599) but i don't get a error. Do you have other apps installed?

@AlexCeg
Copy link
Author

AlexCeg commented Nov 12, 2024

Hi,
I retried it. It works in one of the newest versions 25.1.25873.26550
but it definetely did not work in 25.0.23364.25738

It would be interesting to know the version with which this problem was solved.
For us the bug does not appear any more so you can close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants