Filter Case List by Owner_Id

I have case sharing based on location set up in my app, so there is a question called owner_id in my registration form which is set when the user selects the location as the answer. Owner_id is then saved as a case property. I wanted to have one case list filtered by a specific owner_id/location, but when I entered “owner_id=‘c9d769ae69e0476b91aa376becce69df’”, the list is not filtered (I can still see every case even if the owner id is not equal to the above). I tried the id with single quotes, double quotes and without quotes, I tried using the location name, and the location site code, but nothing filters the list.

Is it possible to filter a case list by an owner_id?

Hi Natalie,

It is possible to filter by owner id, apologies for the confusion and lack
of clarity on this point.

There are a couple of case properties (case_id, case_type, owner_id,
and status) which are represented differently internally, in order to
reference them in case list filters, they must be preceeded by an @ sign.

In your case you would reference the owner id in the filter as

@owner_id=‘c9d769ae69e0476b91aa376becce69df

As a very technical explanation you can find the XML document structure of
the case database on the device on our wiki, which will provide clarity
into how these references function if you are familiar with XML/XPath,
which is the foundation of our data model/query structure

-Clayton

1 Like

Hi Clayton,
Follow up question: are you able to filter case list by properties of the owner? So instead of filtering by the current session’s user properties, I would want to sort by the owners user properties.

Thanks!

Hi Natalie,

Unfortunately this is quite difficult when cases are owned by users, as user data models aren’t distributed to all devices.

To accomplish the use case you are referring to, you’ll need to use the Organizations (or ‘Locaitons’) feature to assign and distribute metadata to the “location”, which would also be the owner of the case. This feature allows you to control what subset of location data is sent to the phones, since otherwise, the devices could end up with more data than they could handle.

-Clayton