# Bug OP-9479 - Work package exports fails for queries using custom fields not enabled for filtering

Project: OpenProject
Status: closed
URL: https://community.openproject.org/work_packages/OP-9479

## Open points

_No work packages_

## Details

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Low |
| Module | Modules and project features / Work packages, Modules and project features / Export / XLS Export, Modules and project features / Export / PDF Export |
| Target versions | 16.5.0 |
| Observed in versions | 12.0.0 |
| Sprint | 16.5.0 |
| Backlog bucket |  |
| Bug found in version (deprecated) | 12.0.x |
| Found in mobile app version |  |
| Follow-up feedback e-mail |  |
| Requires doc change | No |
| Accessibility | No |
| Pull preview |  |
| List |  |
| Labels |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee |  |
| Accountable |  |
| Product manager |  |
| Developers | Andrej Sandorf, Jens Ulferts |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Planning

| Attribute | Value |
| --- | --- |
| Relevance |  |

## Costs

| Attribute | Value |
| --- | --- |
| Votes |  |
| Work |  |
| Labor costs |  |

## Description

### **Environment**:

Your OpenProject Version: 12.0.1

### **Steps to reproduce:**

1.  Create a work package custom field, tick 'Used as a filter'

2.  Create a work package query using this custom field as a filter

3.  Edit the custom field and uncheck 'Used as a filter'

4.  Open the work package query and try to export as, say, XLS

Also broken in this scenario:

  - The filter button shows e.g. (2) filters in the count badge, but only one is shown in the filter configuration list, so users cannot remove it

  - "Save" and "Save as" don't work, errors are thrown in the console, but no error message appears on screen

### **Actual Behavior**

A red error message with "Bad request."

### **Expected Behavior**

The export works, the invalid filter is ignored.  
The invalid filter field is omitted (not shown in the count badge or the filter list).  
Saving and saving-as does work without throwing an exception in the console

<br>
