Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The below example would match against an issue that has all the following values:

Field A

Field B

Field C

apple

blueberry

carrot

(info) Since JEMH 3.3.21 we lock down access to arbitrary classes in the script context, they cannot be accessed using historic methods:

...

These specific classes were not initially added, are available since JEMH 3.3.38

Info

Due to issues highlighted on the following page,https://thepluginpeople.atlassian.net/wiki/spaces/JEMH/pages/3974856709/Using+Java+17#Classnotfound-exception-when-using-%E2%80%9Cjava.type%E2%80%9D. It means that if you are using Java 17 with Nashorn installed within jira-install/lib then you will need to use JEMH 4.1.33+ and then use the following instead of lines 4 and 5:

  • Code Block
    var filter = pagerFilter;
    var builder = jqlQueryBuilder;

These specific classes were not initially added, but are available since JEMH 4.1.33+

Code Block
languagejs
//get the user to run the JQL query as
var user = userManager.getUserByName("admin");

var filter = Java.type("com.atlassian.jira.web.bean.PagerFilter").getUnlimitedFilter();
var builder = Java.type("com.atlassian.jira.jql.builder.JqlQueryBuilder").newBuilder();

//construct the JQL query
var query = builder.where().defaultAnd()
	.field("Field A").like("apple")
	.field("Field B").like("blueberry")
	.field("Field C").like("carrot")
	.buildQuery();

//get list of issues (could be empty)
var results = searchService.search(user, query, filter).getIssues();

//get first issue if exists and add via issueKey directive
if (results.size()>0) {
    var issue = results[0];
    resultMap.put("issueKey",issue.getKey());
    print("Found using JQL: "+issue.getKey());
} else {
    print("No issues match using JQL.");
}

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@22b016
showSpacefalse
sortmodified
showSpacetypefalsepage
reversetrue
typelabelspagescripting jql
cqllabel in ( "jql" , "scripting" ) and type = "page" and space = "JEMH"labelsscripting jql


Page Properties
hiddentrue


Related issues



...