Prefiltered Case Searches

For this entry, I thought I would connect the dots on two previous entries by describing a commonly asked use case that builds on them.

In the blog entry Preload Case List, we showed how to create a simple script, triggered by ICM 5.2's Page Open events, that is used to pre-fill the Case List when a user first logs into Case Manager Client.

Blog entry Access User Information showed how to use scripts to easily access the current user's name, ID and role. This example, in combination with the previous pre-fill one, could be used to have the Case List automatically display a list of cases that the current user owns by including a Case Owner property on the case and adding it to the search criteria.

For this use case, let's say we always want users in a specific role to only ever see cases that they own. Using the examples above, we can ensure that the Case List pre-fills with their cases; but what if they use the Search widget? How do we ensure the filter on owner is maintained there as well? Here's how:

Add a Case Owner property to your solution. This property value should have your user ID assigned to it for a couple of cases

Add a Script Adapter widget to the hidden area of the Cases page for the role where you want the filtering to always happen (remember you can set which Case page a specific role sees using the option on the main Case Type page in Case Builder).

Disable the Search Cases Broadcast event by going to the Event Broadcasting tab on the Search Widget's Wiring settings. This ensures the event is only ever sent through wiring and always intercepted by our Filter Search script.