Skip to main content
Skip table of contents

Search Issues with related Cases using JIRA JQL Functions

Please note that this feature is only supported for Jira Server and Jira Data Center.

Jira Cloud

In Jira Cloud, to search for issues that have at least one related Case we can use the following JQL query.

CODE
issue.property[relatedSalesforceEntities].total>0

Jira Server and Jira Data Center

SFQUERY()

This function is used to filter JIRA Issues (with related Cases) based on Case object properties and/or Case-related objects using SOQL (Salesforce Object Query Language) condition expression inside JQL (JIRA Query Language).

In order to use sfquery(), it is necessary to use the API Name of the Salesforce fields.

Usage (in JIRA JQL)

Issue IN sfquery(<SOQL QUERY CONDITION>)

The query will search for all the JIRA Issues with related Salesforce Cases that satisfy the condition in <SOQL QUERY CONDITION>.

Example (via Advanced JIRA Search):

CODE
Issue in sfquery("case.Origin = 'Web'")

Where “Origin”  is the API Name of the Case origin standard field.

Note that the content inside the double quotes indicates the SOQL criteria, This query will return JIRA Issues linked to Case(s) that have Origin = “Web” .

Pagination

SFQUERY() Also allows you set the pagination results with :
Usage

Issue IN sfquery(<SOQL QUERY CONDITION>,<STARTING PAGE>,<NUM PAGES>)

sfquery() allows pagination of 2000 issues per page:

Example:

CODE
Issue in sfquery("case.Origin = 'Web'",0,5)

This will  get a max of 10000 JIRA Issues related to Case(s) in advanced search in JIRA.

You can also use In order to get the next 10000 issues:

CODE
Issue in sfquery("case.Origin = 'Web'",5,5)
Getting the API name of Salesforce fields

You can look for the API name of the standard fields under Setup →  Build → Customize → Case (or any Object)-> Fields.

For Standard Fields look for the column Field Name  denotes the API name of the standard fields:

For Custom Fields look for the column API Name

You can also download the PDF for all standard field names from:
https://help.salesforce.com/help/pdfs/en/salesforce_field_names_reference.pdf

Common SOQL operators

SFQUERY() accepts SOQL syntax.

Using Logical Operators:

Example:

CODE
Issue IN sfquery("case.Issue_Type__c='Improvement' AND case.Origin='Email'")
CODE
Issue IN sfquery("case.Priority='High' OR case.Origin='Web'")
Using Comparison Operators

Example:

CODE
Issue IN sfquery("case.Issue_Type__c Like '%Improvement%' AND case.Origin='Email'")
CODE
Issue IN sfquery("case.CaseNumber >= '00041045'")

You can also check the SOQL syntax and conditions here:
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_sosl_where.htm

Filtering by Case related objects

SFQUERY() can filter by fields from Case related objects like Account, Contacts, etc

Usage:

CODE
Issue IN sfquery("case.<Related-Object>.<Related-Object.Field">)

Example:

CODE
Issue IN sfquery("case.Account.name = 'Aurora Feint'")

The example above returns all the Issues with a case related that have the Account “Aurora Feint

Filtering by Issue created from Salesforce

JIRA Issues created from Salesforce can be returned with SFQUERY() .

CODE
Issue IN sfquery("zissue_sf.zsfjira__IssueCreated__c = true")

the query above is using the alias zissue_sf in order to replace the table api name zsfjira__ZIssue_SF__c

SALESFORCEISSUES()

This function returns every Issue  that have at least one Case related and it can be used with a case number as a parameter to make more specific query.

Examples:

 Without parameter:

CODE
Issue IN SalesforceIssues()

This query will return all the Issues with at least one  cases related.

Using with parameter CaseNumber:

CODE
issue in SalesforceIssues("00047017")

This query will return  the Issues that are related to Case No. “00047017”.


JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.