Can I manipulate Widget Filters from Client/Server Script?

Hello!

So I have one Workspace, that has a Quick List widget. I want to apply filters to this widget using some JS/Python logic. How can I reach the filter options from JS/Python to manipulate it?

My specific scenario: The filter is on the (Department) field. I’ll fetch Department for the logged-in user, and show only Documents for that Department.

The manual approach I could think of is duplicating the Workspace for each Department, and showing/hiding accordingly, but I have close to 50 departments and I don’t think this is a technically feasible approach.

I am thinking of injecting the JS either app-wide using hooks.py or on the specific widget using a custom HTML block.

Let me know your hints and thoughts!

Regards

Similar, but for a Widget instead of listview: