Forums

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

Get issue id of last created issue, and check issue type

-
Contributor
November 30, 2020

Referencing the round robin assignment script from adaptavist library:https://library.adaptavist.com/entity/round-robin-assign-issue-to-users-in-a-certain-project-role, I want to get the last issue created in a project, but i also want to focus in on a certain issue type. 

Here's what I changed in the script:

def lastIssueIdWithAssignee = issueManager.getIssueIdsForProject(issue.projectObject.id)
.sort()
.reverse()
.find {issue.getAsString("issuetype") == "Certification" }

So with this, I thought I'd be able to find the last Certification issue created in that project, but this doesn't seem to be the case...because the assignee keeps defaulting to the first user listed in the user key array.

Is there anything wrong with the change I made to the script?

1 answer

Suggest an answer

Log in or Sign up to answer
0 votes
Hana Kučerová
Community Champion
November 25, 2019

Hi @Fomin Dmitriy 

I've just tested your code and it worked for me.

On which event(s) do you fire this script? I've tried it only with the "Issue Commented" event.

How is your scripted field defined? I've inserted only random text value without any code.

Which version of Jira/ScriptRunner do you have?

Fomin Dmitriy
November 26, 2019

Hi, @Hana Kučerová 

Version of ScriptRunner is 5.6.2.1-jira8 
I use "all issue events".

The result of calculating the field value is formed as follows:

def result = RName + " (" +RDate.format("dd-MMM-yyyy") + ")"
def jqlname = URLEncoder.encode(RDate, "utf-8")
return '<a href=https://"mybazeURL"' + jqlname + '" >' + result + '</a>'

 

Here is "mybaseurl" - replaces full URL address, "RDate" and "RDate" - calculated value.

TAGS
AUG Leaders

Atlassian Community Events