How to persist data in database for customized registration app?

I managed to figure out how to customize the registration app to look like this:

image

However, when creating a new user, none of the new fields get added to the database. I’m not terribly surprised this isn’t happening because I figured I would need to do something with the database, but I have no idea how to connect a new column in a table with Phone Number2, for example.

  1. How do I connect this information?
  2. And just to check in advance, where in the UI can this new custom information be viewed?
  3. Can this custom information be edited?

For reference, below is my custom registration app JSON. I’m on OpenMRS WAR Version: 2.2.0 Build ab94ff. Registration App Module 1.13.0, Registration Core Module 1.8.0.

{
  "id": "referenceapplication.registrationapp.customReg",
  "instanceOf": "registrationapp.registerPatient",
  "label": "Register Patient",
  "description": "Create a new Patient Record",
  "extensions": [
    {
      "id": "referenceapplication.registrationapp.registerPatient.homepageLink",
      "extensionPointId": "org.openmrs.referenceapplication.homepageLink",
      "type": "link",
      "label": "referenceapplication.app.registerPatient.label",
      "url": "registrationapp/registerPatient.page?appId=referenceapplication.registrationapp.customReg",
      "icon": "icon-user",
      "order": 1,
      "requiredPrivilege": "App: registrationapp.registerPatient"
    }
  ],
  "config": {
    "afterCreatedUrl": "/coreapps/clinicianfacing/patient.page?patientId={{patientId}}",
    "sections": [
      {
        "id": "contactInfo",
        "label": "registrationapp.patient.contactInfo.label",
        "questions": [
          {
            "legend": "Person.address",
            "fields": [
              {
                "type": "personAddress",
                "label": "registrationapp.patient.address.question",
                "widget": {
                  "providerName": "uicommons",
                  "fragmentId": "field/personAddress"
                }
              }
            ]
          },
          {
            "legend": "Phone Number1",
            "id": "phoneNumberLabel1",
            "fields": [
              {
                "type": "personAttribute",
                "label": "What's the patient's primary phone number?",
                "formFieldName": "phoneNumber1",
                "uuid": "14d4f066-15f5-102d-96e4-000c29c2a5d7",
                "widget": {
                  "providerName": "uicommons",
                  "fragmentId": "field/text"
                },
                "cssClasses": [
                  "phone"
                ]
              }
            ]
          },
          {
            "legend": "Phone Number2",
            "id": "phoneNumberLabel2",
            "fields": [
              {
                "type": "personAttribute",
                "label": "What's the patient's secondary phone number?",
                "formFieldName": "phoneNumber2",
                "uuid": "0214d4ed-d37c-45b9-b81e-4330d9af4905",
                "widget": {
                  "providerName": "uicommons",
                  "fragmentId": "field/text"
                },
                "cssClasses": [
                  "phone"
                ]
              }
            ]
          },
          {
            "legend": "Email",
            "id": "email",
            "fields": [
              {
                "type": "personAttribute",
                "label": "What's the patient's email address?",
                "formFieldName": "email",
                "uuid": "01dff993-b1c3-4373-ab99-75eabf1420c1",
                "widget": {
                  "providerName": "uicommons",
                  "fragmentId": "field/text"
                },
                "cssClasses": [
                  "email"
                ]
              }
            ]
          }
        ]
      },
      {
        "id": "relationships-info",
        "label": "registrationapp.person.relationship",
        "questions": [
          {
            "legend": "registrationapp.person.relationship.label",
            "header": "registrationapp.person.relationship.question",
            "fields": [
              {
                "type": "personRelationships",
                "widget": {
                  "providerName": "registrationapp",
                  "fragmentId": "field/personRelationship"
                }
              }
            ]
          }
        ]
      },
      {
        "id": "emergencyContact",
        "label": "Emergency Contact",
        "questions": [
          {
            "legend": "Name",
            "id": "emergencyContactName",
            "fields": [
              {
                "type": "personAttribute",
                "label": "What is the patient's emergency contact's name?",
                "formFieldName": "emergencyContactName",
                "uuid": "78359628-f652-4679-844d-100373ffd392",
                "widget": {
                  "providerName": "uicommons",
                  "fragmentId": "field/text"
                }
              }
            ]
          },
          {
            "legend": "Phone Number",
            "fields": [
              {
                "type": "emergencyContactPhoneNumber",
                "label": "What is the patient's emergency contact's phone number?",
                "formFieldName": "emergencyContactPhoneNumber",
                "uuid": "e80d0801-cd07-45a6-b401-90e405e9f897",
                "widget": {
                  "providerName": "uicommons",
                  "fragmentId": "field/text"
                },
                "cssClasses": [
                  "phone"
                ]
              }
            ]
          }
        ]
      },
    ]
  }
}

@jasonmfry you can make a personAttributeType and use the UUID in

for storing the Phone number as personAttribute.