Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

why is issueFieldExactMatch() not working with any regex?

SWAPNIL SRIVASTAV
Contributor
December 5, 2019

I need to perform EXACT search. I am using below query:

issueFunction in issueFieldExactMatch("project = ABC and issuetype=DE", "summary", "FGH")

and it is returning correctly the issues with summary "FGH", but I want to list issues with summary "fgh" also.

I cannot use issueFieldMatch() because that would give results with nearby values as well like "fghij" or "ABCFGH".

I need to perform exact search but it should be case-INsensitive.

Also, any search with regular expression in issueFieldExactMatch() is not working, I do not uderstand why is that. As per documentation

below JQL should work:

issueFunction in issueFieldExactMatch("project = ABC and issuetype = DE", "Summary", "^T.st$")

I have issue with Summary "Test" but it is not giving any results.

 

Kindly help

Regards,
Swapnil Srivastav

1 answer

1 accepted

Suggest an answer

Log in or Sign up to answer
1 vote
Answer accepted
Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 7, 2018

Hello @Dan27

You can get it via changeHistoryManager like this

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue

// Uncomment this to test is script console and place correct issue key
//MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject("TEST-1")

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def history = changeHistoryManager.getChangeItemsForField(issue, "Epic Link")
if (history.size()>1){
def prevousEpicLink = history.last().fromString
log.error("prevous epic: ${prevousEpicLink}")
}
Dan27
Contributor
August 8, 2018

Perfect Thanks ! :) @Mark Markov

No, How can I set this prevousEpicLink to the Epic Link field ?

Mark Markov
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
August 8, 2018
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.MutableIssue

// Uncomment this to test is script console and place correct issue key
//MutableIssue issue = ComponentAccessor.getIssueManager().getIssueObject("TEST-1")

def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def history = changeHistoryManager.getChangeItemsForField(issue, "Epic Link")
def customField = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Epic Link")
def issueManager = ComponentAccessor.getIssueManager()
if (history.size()>1){
def prevousEpicLink = history.last().fromString
log.error("prevous epic: ${prevousEpicLink}")
def epicIssue = issueManager.getIssueObject(prevousEpicLink)
issue.setCustomFieldValue(customField, epicIssue)
issueManager.updateIssue(null, issue, EventDispatchOption.DO_NOT_DISPATCH, false)
}
Dan27
Contributor
August 8, 2018

Thanks!!! Work perfectly!

TAGS
AUG Leaders

Atlassian Community Events