Search Category Filtered by role

Hi all,

Looking to see if it is possible to filter the results presented to a user based upon their role within Cases.

If the user belongs to ‘Customer Services’ they should only see categories that they assigned to view.

Any help with this would be much appreciated!


You would need to extend the “Text field as Drop Down Filter” presenter to know about the relation, via the group, to the current user.

I’ve just given this a go, and it appears to work:

  1. Add the following setting (possibly to a copy of the presenter, just to be on the safe side), within get_settings in main.js:

             main_label:"Path to ID field in USER object for filtering",

…and change the code in get_template_data() to this:
let filters = [];
if (presenter.get_setting(‘path_to_user_id’) && presenter.get_setting(‘path_to_user_id’).endsWith(’:id’)) {

    var recordset ={
        'distinct': true,
        'order':[{'field_path':presenter.get_setting('field_current_activity'), 'direction':'ASC'}],

    return {

…then in your form definition, set this new setting to run down the relationship from CASE SUMMARY => Group Cases => GU Mapping to Group => Internal User to GU Mapping
…and select ID

1 Like

Hi Phil,

Thanks very much for this. When I have applied your suggestions to the code and changed the Text Field to Filter to Internal User to GU Mapping, the ID option only presents two categories to filter from regardless of role. Have I implemented this incorrectly?


I was changing the wrong filter and it works perfectly.

Thanks very much!

1 Like

Just a thought, is it possible to get the same functionality with the Stage dropdown too?

In theory, yes: the presenter is giving a distinct list of values from records in the case summary data object. All we’ve done here is apply a filter to only those records which are linked to the user through the group mapping - I’m not sure it’s quite as relevant for Stage, as in the same stages apply to cases irrespective of whether the user can see that particular category of case, but it should mean you won’t be able to filter the list down to nothing.

1 Like

Yeah that is a good point. I am sure once the forms are filtered down they wouldn’t much more in the way of this feature as it would obvious on the list.

Thanks for your help!