Skip to end of metadata
Go to start of metadata

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

Compare with Current View Page History

« Previous Version 11 Next »

If you are here is because you are probably getting the error The case sharing settings for your user are incorrect. This user must be in exactly one case sharing group. Please contact your supervisorBefore we start debugging this error let's understand a few relevant concepts:

  • Case sharing - if an app has Case Sharing enabled, cases are supposed to be shared between users. For more on this, see Case Sharing.
  • Case Ownership - every case in CommCare has an owner that can be a user (web or mobile), a user group or a location, which means that before a case can be created its ownership needs to be decided. The decision of who (or what) should be the owner is normally done by CommCare but can also be done manually, as we will explain later. However, when Case Sharing is enable this process becomes complex for CommCare as the User, the default option, is no longer acceptable.

Let's now interpret the error. Mainly, Case Sharing is enabled and CommCare is responsible for determining the owner of cases but because of some incorrect user configuration or many options available, CommCare gets "confused" and throws that error, so potentially, this could be solved by setting the ownership manually. An important note here is that, in most of the scenarios this error is directly related with some design decision made for the app so it's good practice to revisit documentation to ensure that whatever solution is applied it won't break any workflow. Let's see the potential situations:

  1. User is not assigned to a Location or Case sharing group - without a Location or Case Sharing Group associated to the mobile user, CommCare is forced to set the ownership to the user but setting the ownership to the user will automatically prevent the case from being shared.
    1. Solution: assign the user to a Location or a Case Sharing Group
  2. User is assigned to more than one case sharing group and/or location - considering that there are many options available, CommCare is unable to decide on who should be the rightful owner therefore resulting in that same error being thrown. This also applies if the user is assigned to one Case Sharing Group and one Location when the Organizational Level is set to Own Cases (see more in Setting up Organization Levels and Structure).
    1. Solution: There are two potential approaches here, change the configuration of the user in terms of to how many Case Sharing Groups (see more in Mobile Worker Groups) or Locations (see more in Assigning Mobile Workers to a Location) they are assigned to or set the ownership manually.
  3. User is assigned to a Location that can't Own cases - in this scenario, CommCare sees that the user is assigned to a Location that, according to the configuration of the Organization Level, can't own Cases.
    1. Solution: There are two potential approaches here, change the configuration of the location (see more in Setting up Organization Levels and Structure) or set the ownership manually.

  4. User is assigned to a Location with child Locations and View Child Data is Enabled - this is a more complex problem to solve because apparently the users are correctly configured and each one is assigned to a single location. But, what happens in reality is that CommCare actually creates a Case Sharing Group to link the parent location to each one of its children resulting in several groups being created, depending on the number of children. So, a user placed in this parent location is under several Case Sharing Groups plus in their own location and if they try to create a case CommCare doesn't know how to set its ownership. Visually, it would be something similar to:
    In this example, we can conclude that Nurse should be able to see cases from their CHWs and also to have their own cases. The error would occur when Nurse tries to create a new case, however, the app should work fine for CHW 1 and 2.
    1. Solution: In this case, usually the only viable option is to set the ownership manually. Of course, you could set the View Child Data option off but this would most likely go against the workflow of the app.   

Setting manually the Ownership of a case

So, at this point it's safe to assume that you have exhausted all other options and decided to set the ownership of the case manually. First we need the ID of the owner, this can be achieved either by having the user selecting a Location or a Case Sharing group from a Multiple Choice Lookup Table question or some calculation that returns a single ID. Next, we need to instruct CommCare to assign the ownership based on that ID, for that we need to set in the Case Management, of the form creating the case, a special property called owner_id, this is the property that holds the ID of the owner of the case. In the end you should have something like:

  • No labels