Unable to "load additional contact data" in app form

Per the documentation’s example of loading additional contact information, I’ve been unable to replicate it in our app form.

I’ve stripped out all other fields to ensure nothing else is influencing the results.

The HHM ID and Name represents the lookup.
As you can see the previously captured ID is displayed and resolving just fine (set via the calculation cell), however the name field does not populate as expected:

The db structure of contact that’s being selected:

  "_id": "35c5877c-2dbe-44c9-ad51-bf6d74ae504d",
  "_rev": "1-055c158a318269356aab698f12f2a602",
  "parent": {
    "_id": "5637719f-acfa-42a7-b71c-86fae598f382",
    "parent": {
      "_id": "313def9f-8aef-462e-90c0-447a21b68d9c",
      "parent": {
        "_id": "753504f3b61fc43106234a6221069819",
        "parent": {
          "_id": "753504f3b61fc43106234a6221066f60",
          "parent": {
            "_id": "753504f3b61fc43106234a6221066416"
  "type": "contact",
  "first_name": "Another",
  "middle_name": "",
  "last_name": "Member",
  "maiden_name": "",
  "name": "Another  Member",
  "resident": "yes",
  "non_resident": {
    "area": "Add a lookup for each selection that can be made",
    "address": ""
  "phone": "",
  "phone_alt": "",
  "obtained_personal_details": "no",
  "id_number": "",
  "pmi_number": "",
  "sex": "other",
  "date_of_birth": "1994-08-23",
  "dob_method": "dob_confirmed",
  "when_member": "at_birth",
  "membership_start_date": "",
  "meta": {
    "created_by": "chw_1-test-859",
    "created_by_person_uuid": "753504f3b61fc43106234a622106b9f1",
    "created_by_place_uuid": "753504f3b61fc43106234a6221069819"
  "contact_type": "hhm",
  "reported_date": 1697477944423,
  "form_version": {
    "time": 1697477218580,
    "sha256": "ce4f563e54780b63995d4374d42a5af77168088048d010581d8b43611b492db8"

The Please choose a household respondent field is to store the value that’s referenced on a follow-up run.

Below a screenshot of the entire example COPC: Household Screening app form:

It can also be found as an xlsx file here.

Note: The exact “lookup” seems to work fine in our hierarchy’s Household contact form.

Is there an implementation detail that I’m perhaps missing, or does this seem like a bug?

— Edit —

I’ve also noticed the following error show up in the console, not sure if it is related:

I have been able to recreate this behavior and I think it should be considered a bug. I have logged a corresponding GitHub issue: Form questions not rendered with values loaded by db-object-widget · Issue #8652 · medic/cht-core · GitHub

The name value is actually getting loaded into the form’s data model. The problem is that the question displayed to the user is not getting re-rendered with the value. Interestingly, if you add a separate question with a calculation that points to the original prev_respondent/name, that question will be rendered properly with the expected value loaded from the contact (see the adjacent_name field in my example in the GitHub issue).

Typically in forms where select-contact is being used, I usually see a dedicated group for the contact’s data that contains all the fields to load from the contact as hidden values. Then, questions for the user to fill out are in a separate group. These questions can still reference the contact’s values (similar to adjacent_name).

1 Like