How to solve duplicate record IDs using "check native sequences"

Overview

In case you imported records and get duplicate ID errors when creating new records from metasfresh, you can use this SQL to recalculate the sequences:

select dba_seq_check_native();

select update_sequences();

Important:
MAKE SURE you are logged in with db user metasfresh when running that command.

Hint: If it is not working, please DROP that particular sequence and run the function again.

Fix native sequence problems from WebUI (System Administrator)

In case you do not have access to the database, you can run a process to fix native sequence problems from metasfresh directly. To do so, please proceed as follows:

  1. Log in to metasfresh with the user role “System Administrator”.
  2. Open the navigation menu and enter the process name Fix Native Sequences into the search field.

    Note: Use shortcut Alt + 2 / ⌥ alt + 2 to open the menu.

  3. Click on the menu item to start the process. You will receive a short message at the top right when the process has been completed.

Possible Error Messages

Error: Cannot retrieve next ID...
Server error
Cannot retrieve next ID from database for DocumentEntityDescriptor{tableName=Product_Category_Purchase_Group, fields.count=10}

View source file on GitHub.com