C/AL rollback without error

If you want to rollback the database changes, but do not want the code execution to end, simply call ASSERTERROR ERROR(”); The ERROR(”) will quietly rollback the data changes, and the ASSERTERROR will capture the error, allowing the code execution to continue.

2 thoughts on “C/AL rollback without error”

  1. Thank you for a valuable tip! Is it considered the good code style though? Looks a liitle bit like a hack 🙂

    1. No, this is absolutely a hack! 🙂 Don’t do it at home, as long as home is Business Central, Microsoft won’t let your code be deployed if you do.

Leave a Reply