You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

Overview

Custom Registration Data is an advanced tool that enables you to store and reference additional information about your users.  By default, when you register a new mobile user you can specify their username, first name, last name, e-mail address, language, role, and phone number. Custom Registration Data allows any number of additional fields. For example, you could note a category of user, additional location data, or other metadata.

Use Cases

Custom Registration Data is likely useful in one of two situations:

  1. You are going to be using custom reports. This is likely something which will involve working close with Dimagi engineers
  2. You want to be able to reference properties about your users.

How to Add Custom Registration Data

1. Bulk Upload

You can use the usual "Upload Mobile Workers in Bulk" tool to introduce and update new fields.

  1. Download the your current users excel file
  2. Add additional columns. It should be in this format: data: field_name. So, for example, if in my forms I only want to ask certain questions if my user has a training level of 3, I can create a data field:
    data: training_level 
  3. Save and upload it!

2. CommCareHQ User Interface

WARNING: it is recommended that you use the Bulk feature above, especially if you are doing this for lots of workers. However, if you really want to know...

  • After clicking on "Add a Mobile Worker" go to the "Custom Registration Data" tab
  • Click on "Edit"
  • Add the "key" (i.e. the name of the property about your user) and the "value mapping" (i.e. the value of the property about your user). For example, if you wanted to store a number related to level of training called training_level, it would look like this:

  • When you have added your data, click DONE and you will return to your user registration

  • IMPORTANT!!! You then have to press "Update Information" or your changes will not be saved. Also, there is no warning message about unsaved changes if you navigate away from this page, so be careful.

How to Reference Custom User Data in an Application

You will have to reference the user data through the commcaresession: instance('commcaresession')/session/user/data/user_data_name

So for example, to reference our training_level data you would need to refer to the following:

if(count(instance('commcaresession')/session/user/data/training_level) = 0, '', instance('commcaresession')/session/user/data/training_level)

The use of the "if" statement prevents CommCare from panicking if it can't find a value for training_level

It is possible that this will only work in forms where a case is being referenced (i.e. form opens or requires a case).

  • No labels