Hide/Remove column in list view based on role or user

Hi guys,

Have any of you been able to hide/remove Hide/Remove column in list view based on role or user:

So far I’m able to identify the role based on information on this post: http://urdhva-tech.blogspot.com/2013/08/readonly-field-conditionally.html

First I tried this method:

I also tried this other approach:

Here is some information on how to change the colors:

At the end I’m confused. If you can please give me a working sample it will be appreciated.



I think you’ve done a good job searching for what is available, and it’s likely you won’t find a more complete example. So I would advise to simply debug what you currently have until you get it right.

I would say you need to solve two problems, do it one by one:

  1. Make a customized list view that displays data based on a condition. See for example https://docs.suitecrm.com/blog/listview-conditional-formatting/ , it uses a different hook than the example you had, and it doesn’t inject Javascript, it’s all PHP.

Once you get that working, then

  1. change the condition to be based on role. This should be easy to achieve from the above examples you found.

If you need further help, please provide full code, and the exact paths you used, etc. Thanks.

Hello there,
I followed this thread for a similar thing, but I need to hide the entire row based on the role
of the user that has been assigned to the record.
So I got the condition working but I’m struggling to hide the entire row…could you help?


Why can’t you set List to Owner in role? This blocks the display of entries where a non-current user is assigned.

Hello and thanks for your answer. I can’t really set that on the owner role because I have two users on the record and I should hide the record only on a certain case that I have already set. I only need to hide the entire row in this certain case!

1 Like

just to let you guys know that, in order to hide the records I didn’t need from the list view, I ended up using the method described in @pgr link

to create the condition and save in a session variable the where condition
$_SESSION['beansToHide'] .= " AND ris_note_spese.id != '".$bean->id."'";

and then used the variable in the view.list.php file

                $_SESSION['beansToHide'] != '' && !empty($_SESSION['beansToHide']) && $_SESSION['beansToHide'] !=null

                $this->params['custom_where'] = $_SESSION['beansToHide'];
                $_SESSION['beansToHide'] = '';
             $this->lv->setup($this->seed, 'custom/modules/ris_note_spese/tpls/ListViewris_note_spese.tpl', $this->where, $this->params);
             echo $this->lv->display();


I can only give directions because I use the solution in my commercial projects.
You can do it easily in two steps:

  1. set the list to “Owner” in role
  2. use the process_record logic hook and only change the assigned_user_id field.

hello @p.konetskiy,
thanks for your answer but perhaps I haven’t explained my self properly!
I can’t use simply the ‘owner’ in role because the permission are based on
the assigned userid and the manager which are two fields in my module.
So the permission is set to group because the manager has to see the records
of the workers but when the record is assigned to a manager then
the other field is assigned to ‘the manager of the manager’ which is a sort of director.
This last thing makes it so that the manager would be able to see the records of the
director when the record is assigned to the director…so this is the problem but I have sorted it
following the steps I explained before.
Thanks for your help anyway :slight_smile:


I understood you. The solution key is here:

Role analysis for access to the record is worked after a logic hook.