Having trouble extending the OpenMRS Registration page

I am trying to add a new section to the registration page in a custom module. See the screenshot below

My use case is, during training, going through the steps of creating a new patient, add encounters, vitals and visits takes time especially when you have to do it repeatedly. What I’m trying to do is make it possible to copy data from an existing patient when registering a new patient. The data I’m interested in is encounters, observations, vitals, visit notes so that when the new patient is saved, it’s dashboard will look exactly like that of the patient which was selected in the first option.

I don’t want to do this via person attribute since I don’t want the patient I’m copying from to be tracked by the new patient. I just need the form to send with the request UUID of a patient then from the controller I can now copy all the data from this patient to my new patient.

I’ve tried two approaches with no luck. I’ve tried manually coding the section in the gsp but this breaks the javascript code with error ‘undefined variable toggleSelection’. I don’t use that variable in my view.

Then I tried the option of doing that using person attribute and adding a configuration to the app.json but it still doesn’t work. I don’t get any errors in my terminal or browser console with this option but I’m not sure why it doesn’t work. Below is my app configuration

        "id": "copypatientapp.basicRegisterPatient",
        "instanceOf": "registrationapp.registerPatient",
        "label": "Copy Patient",
        "description": "Create a new Patient Record from another patient record",
        "extensions": [{
            "id": "copypatientapp.basicRegisterPatient.homepageLink",
            "extensionPointId": "org.openmrs.referenceapplication.homepageLink",
            "type": "link",
            "label": "Copy Patient",
            "url": "copypatientapp/registerPatient.page?appId=referenceapplication.registrationapp.registerPatient",
            "icon": "icon-copy",
            "order": 1,
            "requiredPrivilege": "App: copypatientapp.registerPatient"
        "config": {
            "afterCreatedUrl": "/coreapps/clinicianfacing/patient.page?patientId={{patientId}}",
            "sections": [
                    "id": "basePatient",
                    "label": "Base Patient",
                    "questions": [
                            "legend": "Patient",
                            "fields": [
                                    "type": "personAttribute",
                                    "label": "Patient",
                                    "formFieldName": "basePatient",
                                    "uuid": "3f831f65-53d4-4447-8178-702c58a73b69",
                                    "widget": {
                                        "providerName": "uicommons",
                                        "fragmentId": "widget/findPatient"
                                    "cssClasses": ["basePatient"]

I created a person attribute of type org.openmrs.Patient then added a section as shown above but no new section is been added and I get no errors. Is there something I’m doing wrong?

Are you able to reproduce this problem on the demo server?

I cannot upload my module on the demo server as that feature has been disabled there. When I add the app using the Manage Apps section, I get an error when I click on the app from the home page saying

org.openmrs.ui.framework.UiFrameworkException: No viewProvider named copypatientapp at org.openmrs.ui.framework.page.PageFactory.getView(PageFactory.java:290)

Can you try modules-refapp.openmrs.org/openmrs/

login: admin/Admin123 doesn’t work there. What’s the login?

I just sent you a private message with the admin password.

Just reproduced on that server. The app id is copypatientapp.registerPatient. On the homescreen it’s Copy Patient. Since it’s a builtin app you cannot access the json from the manage apps section but the json is exactly like what I posted earlier on the thread.

Which of these is your person attribute type? https://modules-refapp.openmrs.org/openmrs/admin/person/personAttributeType.list

Oh. I didn’t add that. I had it on my own server forgot to add it there. Let me do that now

Fixed. The person attribute type used is Base Patient

Does it have the same uuid as the one in your config?

Yes. I reuploaded the module after adding that person attribute.

Can you paste its config at pastebin.com?

Here https://pastebin.com/KwXF9dz9

Accessing the paste link gives me “This page has been removed!”