[SOLVED] Failing to update user accounts without OpenMRS ID after migration

We are upgrading installations from 1.6.3 which were using an old configuration of the OpenMRS ID (without a check digit)- and with the new installations we have changed to use a new auto generated OpenMRS ID with a check digit.

The challenge we are facing is that when saving users, they do not have the new OpenMRS ID which is a required identifier.

  1. Is an SQL script or a batch Java code example for adding new identifiers for existing patients?

  2. Is there a way to enable OpenMRS to auto-generate missing identifiers if the autogenerate option is set?

You could loop through patients without that identifier and assign them one using this method: https://github.com/openmrs/openmrs-module-idgen/blob/master/api/src/main/java/org/openmrs/module/idgen/service/IdentifierSourceService.java#L106

@dkayiwa Thank you let me try that

The final solution was to find all patients who did not have the specified identifier and add it to the custom module activator