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

Compare with Current View Page History

« Previous Version 7 Next »

Overview

Custom Registration 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 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 useful in 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 additional data about your users in an application, like a mobile worker's district, training level, or work unit

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 your forms you only want to ask certain questions if your user has a training level of 3, you 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 click on "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 the training_level data such that you only want user with training level 3 to see something, you would need to refer to the following:

if(count(instance('commcaresession')/session/user/data/training_level) = 3, '', 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

Note that in the expression above '' indicates two single quotation marks (= null), not one double quotation mark.

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