Preview Changes made to records

Hi,
I am still relatively new to the Navision World. I want to modify a certain set of records in c/al. I managed to write the code, but I am still a little unsure, if my code REALY does the things I would like to. Is there a way to see my changes, before I commit them to the database?
I am sadly still working on NAV2009R2.

Answers

  • AK
    AK Member Posts: 226
    edited 2017-06-23
    Put a

    IF NOT CONFIRM(record,false) THEN ERROR('');

    in your code or use the debugger to inspect the record and click on "Stop debugging" if you don't want the record to be written.
    A bit more complicated, but useful if you modify a lot of records is calling a form which displays the records just before a CONFIRM statement like above. You might have to create the form first or use a already existing one, depending on the table.
  • lubost
    lubost Member Posts: 633
    If you want to inspect your set of records after your code finishes:
    - add the column to table (e.g. boolean), set it to true in your code and you will be able to find your records and delete them or return values back.
    - copy all the data to another table and you will be able to completely restore the data.

    Never do those attempts on production database. Ensure code on testing environment.