# jco-filter

## Description

With the jco-filter shortcode you can display a sortable table with the result of a Jira JQL filter.

## Examples and Outputs <a href="#examples-and-outputs" id="examples-and-outputs"></a>

{% code overflow="wrap" %}

```
[jco-filter host="1071" jql="project=ADMIN AND resolution=unresolved" fields="issuetype,priority,key,summary,status" showcount="true"]
```

{% endcode %}

<figure><img src="https://739919931-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FQyqhXpUcAdSvpEMskTcv%2Fuploads%2FTXpa7hL6I5Yy4Cyi0u1N%2Fscreenshot-7-768x576.png?alt=media&#x26;token=dfa2b87e-e0a1-42de-97ab-bfdfe8579472" alt=""><figcaption></figcaption></figure>

## Format

{% code overflow="wrap" %}

```
[jco-filter parameter="value" ...]
```

{% endcode %}

|            |                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    |            |
| ---------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------- |
| fields     | <p>A comma separated list of Jira fields to display. The following fields are supported:</p><ul><li>issuetype</li><li>priority</li><li>key</li><li>summary</li><li>description</li><li>reporter</li><li>assignee</li><li>created</li><li>duedate</li><li>versions</li><li>fixVersions</li><li>resolution</li><li>status</li></ul><p>If you did not yet specify a default list of fields in the global options, you must use this parameter. Otherwise the table will be empty.</p> | *no value* |
| headers    | A comma separated list of the column headers to display. If you use this optional parameter, it should contain as much entries as the fields= parameter. If omitted, the field names are used as column headers.                                                                                                                                                                                                                                                                   | *no value* |
| host       | <p><mark style="color:red;"><strong>\*</strong></mark> Mandatory.</p><p>The post ID of the Jira host</p>                                                                                                                                                                                                                                                                                                                                                                           | *no value* |
| jql        | <p><mark style="color:red;"><strong>\*</strong></mark> Mandatory.</p><p>The JQL query you want to run on the host</p>                                                                                                                                                                                                                                                                                                                                                              | *no value* |
| maxresults | How many results (matching issues) to display                                                                                                                                                                                                                                                                                                                                                                                                                                      | 50         |
| showcount  | <p>Show a count of the query result above the table. </p><p></p><p><strong>Example</strong></p><p><em>Showing 20 of 7650 results (match 1 to 20)</em></p><p></p><p>In the above example:</p><p>20 = maxresults<br>1 = (startat-1)</p>                                                                                                                                                                                                                                              | false      |
| startat    | Which result is the first to show. 0 is the first result. (If you want to start at the 51st result you need to set this to 50).                                                                                                                                                                                                                                                                                                                                                    | 0          |

{% hint style="info" %}
If you do not want to provide the fields parameter, you can define the default fields in the options of the Lewe Jira Connector in the WordPress back-end.

If you provide the fields parameter, none of the default fields will be shown. In that case you need to specify all the fields you want to see.
{% endhint %}

## Custom Fields

Custom fields can be added to your jql= parameter in the format of:

`cf{{1234}}`

The above example is translated by the Lewe Jira Connector into `cf[1234]` which is the correct JQL format.

In the fields= parameter you must use the format `customfield_1234` to add the column to the output.

Jira only delivers back the value of your custom field, not its name in your Jira instance. If you want your column to have a speaking name, you can add on via the headers= parameter.

Let's say you have a custom field "Customer" in your Jira instance with ID 1234. The following shortcode would display the field with a proper column header:

{% code overflow="wrap" %}

```
[jco-filter host="398" jql="project=ADMIN AND resolution=unresolved AND cf{{1234}} = ACME" fields="issuetype,priority,key,summary,status,customfield_1234" showcount="true" headers="T,P,Key,Summary,Status,Customer"]
```

{% endcode %}
