Popular Help ContentNo popular content.
Custom User Data is an advanced tool that enables you to store and reference additional information about your mobile workers. By default, when you register a new mobile worker you can specify their username, first name, last name, and password. Custom User Data allows any number of additional fields. For example, you could create a category of userusers, additional location data, or other metadata.
Configure Custom User Data
In this stage, you must define what data fields you want to collect for each mobile user.
You will be brought to Edit User Fields page:
On this page, you have the option of adding fields to collect for mobile workers. For each field you will need to define the following:
- User Property: The unique ID you can use to reference this property in the application builder. The property may not contain spaces. This field is analogous to a "Question ID" in the form builder.
- Label: The field label that users will see when adding or editing a User in CommCareHQ.
- Required: Indicates whether this field is required for each user. If it is marked as required then you will not be able to create a mobile worker without filling in this field. It will also show up on the main "create mobile worker" page.
- Validation: here you specify the type of input expected, the options are:
- none: you would like to use free text input;
- choices: if
- you want to pre-define choices to appear as a dropdown
- ; or
- Regex: if you would like to use a regular expression for validation of the input. This is useful for validating that custom user data, custom location data, or custom product data follow a specified format. To design and test your regular expressions, you can use this website: http://www.regexr.com/.
To add a new field click on "Add New Field" and fill in the User Property and Label fields.
Here is an example with three user properties:
This configuration would then update the Mobile Worker Registration Page to look like this:
Add Custom User Data
After you configure the user data, each time you add a new mobile worker the CommCareHQ user will be prompted to populate the field, in addition to the standard username and password fields. Required fields will have to be populated at the time of creating the mobile worker, while other fields are optional. These can be filled - in during registration, or when editing a worker account.
2 - Bulk User Upload
This feature (Bulk User Management) is only available to CommCare users with a Standard Plan or higher. For more details, see the CommCare Software Plan page.
if(count(instance('commcaresession')/session/user/data/village) > 0, instance('commcaresession')/session/user/data/village, "Unknown")
Use a Custom User Data in a Display Condition
Accessing Phone Number and the User Name
The user's first and last name, and phone number are Some additional information is also available through custom user data. They are automatically added to the data:
|User's first name||instance('commcaresession')/session/user/data/commcare_first_name|
|User's last name||instance('commcaresession')/session/user/data/commcare_last_name|
|User's phone number||instance('commcaresession')/session/user/data/commcare_phone_number|
|User's primary location||instance('commcaresession')/session/user/data/commcare_location_id|
|User's locations||instance('commcaresession')/session/user/data/commcare_location_ids||space-separated list|
|User type||instance('commcaresession')/session/user/data/commcare_user_type||"web" or "commcare"|
For example, to combine the user's first and last name into a single name in a hidden value, you can do the following:
Removing Custom User Data and Handling "Uncategorized" Data
As described above, you can remove fields on the "Edit User Fields" page. Removing a field does not necessarily remove the data that is attached to users.
This unrecognized data will still appear in mobile worker downloads and can still be edited. It will appear in columns marked "Uncategorized."
There are instances where custom user data will not be activated when used in an Application that was copied from another one