Xfrom Registation Auto Generation of Patient ID's

As part of our registration process I wish to generate an external id (for paper file management purposes) than follows a particular structure.

I have created an xform for patient registration - marginally modified from the default (label changes) - and followed the instructions at https://wiki.openmrs.org/display/docs/XForms+Module+Patient+Registration including those for idgen.

I have created a new patient identifier type using our desired structure and successfully populated an initial identifier pool.

However, when I come to register a test patient with the xform the patient identifier field is not auto populated but requires mandatory keyboard entry. However, the validation rules follow those expected.

Further when a valid id is typed and the form submitted an error message “Patient is missing the following required identifier(s): OpenMRS ID” is given.

Can anyone suggest what I am doing wrong?

On the patient identifier type management screen, turn off the required attribute for the OpenMRS ID identifier type. http://int02.openmrs.org/openmrs/admin/patients/patientIdentifierType.form?patientIdentifierTypeId=3

To have your auto generated identifier display on the form, ensure that the identifier type id that you specified in the setting named “xforms.new_patient_identifier_type_id” is properly configured for auto generation on the screen that looks like this: http://int02.openmrs.org/openmrs/module/idgen/manageAutoGenerationOptions.list


I had not not made the auto generate settings as you suggested, but having done that nothing has really changed. This gif shows you what is currently happening.

Are you able to reproduce it at int-refapp.openmrs.org? Am pointing you to this because i do not have access to your server. :slight_smile:


I have done this (it will of course change the ref app site for anyone using it for other purposes) andi the process I noticed the global variable xforms.new_patient_identifier_type_id is initially numeric (1). On my test system I had created my new type with a name which I used at this place rather than some sort of numeric index. I now note that when I examine the type the url contains id=4 and so have changed the xforms.new_patient_identifier_type_id to 4. This now causes an ID to be auto generated (great).

However when I submit I am told “Patient is missing the following required identifier(s): OpenMRS ID”

On the demo site I get a similar message but referring to my new id type, also on the demo site the new id type does not show in the pull down of id types in the patient registration form.

Did you turn off the required attribute for the OpenMRS ID identifier type as i advised before?

You have it - once more my error - sorry. I will try and leave you in peace for a while.

I may get bored if you leave me for long. :smile: