Morning ;
I have a problem. My code:
when I put the JQL I think that is bad, cause the result is not good, I don't know that I will do... please help me...
I put the code here:
def result2 = post("/rest/api/2/search/")
.header('Content-Type', 'application/json')
.header('accept', 'application/json')
.queryString("startAt", 0)
.queryString("maxResults", 10) // If we search for too many issues we'll reach the 30s script timeout
.body('{"jql":"issuetype in subTaskIssueTypes() and ${it.name} is EMPTY"}')
//.body('{"jql":"issuetype in subTaskIssueTypes() and '\'Tipologia de imputación'\' is EMPTY"}')
.asJson()
if (result2.status == 200){
int contCustom = result2.body.array.total
}else{
contCustom = 0
}
if (contCustom > 0){
logger.info('XXXXXXXXXXXX')
}
I can see you are having a problem with the syntax of the JQL here. The first error is because the field name appears to be trying to use the $ character and this is specifically a reserved character in JQL.
But in your second query, it looks like you have an addition set of single quotes ' ' surrounding your custom field name here.
I think your commented out line is actually closer to what you want and should probably look like this instead:
.body('{"jql":"issuetype in subTaskIssueTypes() and \'Tipologia de imputación\' is EMPTY"}')
However if this does not work, could you go into your Jira Cloud site, visit the issue navigator, and then run the advanced search you are wanting to search. I am curious to see the exact syntax in the search bar in Jira Cloud when this works. If we have that, we should be able to safely create this REST API call.
In addition to this, you could go to the Jira Cloud search site and just start typing out this custom field name. The autocomplete in Jira should show you a custom field number in a format like this
Tipologia de imputación - cf[12345]
If we can see that custom field number is, we could also refer to that custom field in another way where we could escape just the bracket characters and search that way, just in case there is something else wrong with the way Jira might be parsing out the field name.
Perhaps changing the query to look like this
.body('{"jql":"issuetype in subTaskIssueTypes() and cf\[12345\] is EMPTY"}')
where 12345 is the custom field number for that specific field.
Thank's, I'm a Junior Admin in Jirra Cloud.
It's good
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Finaly I used
def aMano = "Tipologia de imputación"
.body('{"jql":"issuetype in subTaskIssueTypes() and '"+ aMano +"' is EMPTY"}')
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.