Filter cases by user

Hi All,

I am struggling to figure out how to filter cases depending on the user.

We currently have 3 major disciplines in our organization and each discipline treats our clients at different points of the client journey. This means that one set of users/discipline may finish with a client much earlier than other users/disciplines. In this situation, on the mobile devices, I would like to remove the case from the users/discipline that has finished with the client but still keep the client visible to the users/disciplines that still need to treat the client. Has anyone got any advice on this point?

Thanks for any suggestions!

First you'll need a way to declare which discipline each user is a part of. This is probably most easily done using Custom User Data.

Then you'd probably want to keep track of which disciplines still needs to interact with the client, say a set of case properties like in_active_treatment or visible_to_clinicians or something. Then you can write a filter expression that factors in these things

    instance('commcaresession')/session/user/data/discipline = 'clinician', in_active_treatment = 'yes',
    instance('commcaresession')/session/user/data/discipline = 'researcher', participating_in_study = 'yes',