Community Health Toolkit

Accessing user object in the xlsform

I have a form which resided at the CHV profile page . I have logged in as a supervisor and I would like to display supervisor’s phone in the form. Currently, I am only able to display supervisor’s username.

How can I display all the values in the user object?

Thanks your for your question @iesmail.

The user object will generally not contain the user’s biodata (name, contacts, etc) but will contain an identifier (contact_id) that can be used to ‘inject’ that document into the form. I’m attaching a screenshot of how you would structure the form to extract the user’s contact details.

Within the inputs section, add a ‘user’ group and within it, extract the contact_id field.
In a separate group, create a hidden string field whose appearance is styled as ‘db-object’ and also hidden and aliases the user contact_id field value. ‘db-object’ forces the loading of documents matching the values bound to a questions (typically uuids).

Please let us know if this helped address the issue.

2 Likes

Thank you Derick for the explanation. I confirm that this works.