Hello,
I am doing a shortcut to get all my assigned issues and their due date. Unfortunately I am not able to retrieve it.
I tried `due_date`, `Due date` but it doesn't work.
In French, it fails with "La valeur fournie pour Nom du champ dans Obtenir la valeur du champ de ticket n'était pas valide." ('The value provided for Field Name in Get Ticket Field Value was invalid.')
Do you have any idea what field name I am supposed to request?
Thanks!
Hi,
this is a snippet from server, but maybe something like this will work on cloud too.
def String jqlQuery = 'project=B'
def fromProject1 = 'A'
def fromProject2 = 'C'
def result = ''
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def searchService = ComponentAccessor.getComponent(SearchService.class);
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
List<Issue> issues = null
def parseResult = searchService.parseQuery(user, jqlQuery);
if (parseResult.isValid()) {
def searchResult = searchService.searchOverrideSecurity(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
issues = searchResult.issues
}
issues.each{ Issue issue ->
def oldKeys = changeHistoryManager.getPreviousIssueKeys(issue.id)
oldKeys.findAll{it==~/$fromProject1.*/}.each{
result += "$it -> ${issue.key}, "
}
issues.each{ Issue issue ->
def oldKeys = changeHistoryManager.getPreviousIssueKeys(issue.id)
oldKeys.findAll(it==~/fromProject2.*/}.each{
result += "$it -> $(issue.key),"
)
This is what it gives me in the script console when i copied and pasted your code snippet and input the projects..
im also not very savvy with scriptrunner, im not great with groovy, so any help would be GREATLY appreciated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
sorry, had some typos in the script that I just fixed and added the imports, please try this again:
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.web.bean.PagerFilter
def String jqlQuery = 'project=B'
def fromProject1 = 'A'
def fromProject2 = 'C'
def result = ''
def changeHistoryManager = ComponentAccessor.getChangeHistoryManager()
def searchService = ComponentAccessor.getComponent(SearchService.class);
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
List<Issue> issues = null
def parseResult = searchService.parseQuery(user, jqlQuery);
if (parseResult.isValid()) {
def searchResult = searchService.searchOverrideSecurity(user, parseResult.getQuery(), PagerFilter.getUnlimitedFilter())
issues = searchResult.issues
}
issues.each{ Issue issue ->
def oldKeys = changeHistoryManager.getPreviousIssueKeys(issue.id)
oldKeys.findAll{it==~/$fromProject1.*/}.each{
result += "$it -> ${issue.key}, "
}
}
issues.each{ Issue issue ->
def oldKeys = changeHistoryManager.getPreviousIssueKeys(issue.id)
oldKeys.findAll{it==~/$fromProject2.*/}.each{
result += "$it -> ${issue.key},"
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
for whatever reason, it only has a problem with those first 4 lines of "import" code... see screenshot.
Thanks for all your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does it work without the imports? Or does it complain then that it does not find the classes in the other lines?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
ok i thought i was getting somewhere, because it ran the query and looked like it was working, but then received this error...
see below:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, thats because it does not find the class Issue, which was in the imports.
I am sorry, I don't know why it does not accept that import that way. This class is also still in the API-Reference.
Maybe someone else does have any idea on this.
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.