If you’re using a debugger, set a break-point there and examine the existing variables in that scope.
Maybe you can try clearing the field from the viewDefs and it will disappear (temporarily, only in that request being handled, because you’re not changing any files).
I discovered that in viewdefs there is the default parameter… if set to false, the column is deleted, but it is moved to the ‘available’ column, this means that a user can still change the layout and make that column available.
You have a condition to test the role, right? So remove the field only when you want.
If I understand correctly, you are in the part of the code that is rendering the view, so what you do there is specific to what is being sent to a specific browser, this particular time.
If I understand your suggestion correctly, you say:
in view.list you identify the role, if it’s customer you remove that section, otherwise, if that section doesn’t exist, you add it. Right?
That is correct. I can’t give you detailed instructions from here (I’m on my vacation). But you posted code above, you have the if there, use it! I don’t know exactly how you’re referencing the viewdefs, but you would just need to remove that item from the correct array.