Forums

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

.setFixVersions doesnt seem to work

Damian Wodziński August 9, 2018

Hello, I do not know why it is not working.

There is some of my code:

def project_key = "RM"
MutableIssue issue = issue
Long project_id = 13713





IssueService issueService = ComponentAccessor.getIssueService();
IssueInputParameters issueInputParameters = issueService.newIssueInputParameters();

void CreateSubIssues(IssueInputParameters iip, Long ProjectID, IssueService issueService, Issue issue)
{
    def key = issue.getKey();
    def reporter = issue.getReporterId();
    MutableIssue missue = ComponentAccessor.getIssueManager().getIssueObject(key);
    Long parent_issue_id = missue.getId();
    def parent_issue_summary = missue.getSummary();
    def linkMgr = ComponentAccessor.getIssueLinkManager();
    def sequence = 0;
    def wasIndexing = ImportUtils.indexIssues
    def currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
    Collection<Version> fixVersion = new ArrayList<Version>()
    fixVersion = issue.getFixVersions()
    //def field = ComponentManager.instance.getFieldManager().getOrderableField("fixVersions")


    def declared_summarys = ["Release Management: ","Scope Registry: ", "Infrastructure Support: ", "UAT Implementation Plan: ", "UAT Implementation Meeting: ", "UAT Fix Registry: ", "System Unavailability Communication: ", "PROD Implementation Plan: ", "PROD Implementation Meeting: ", "PROD Fix Registry: ", "Risk/Problem Registry: ", "Lessons Learned Registry: ", "Report: "]

    for(int i = 0;i<13;i++)
    {

        if(i==0)
        {
            iip.setProjectId(ProjectID)
                    .setAssigneeId(issue.getAssigneeId())
                    .setIssueTypeId("3")
                    .setSummary(declared_summarys[i]+parent_issue_summary)
                    .setReporterId(issue.getReporterId())
                    .setDescription("")
                    .setStatusId("10022")
                    .setPriorityId("4")
                    .setFixVersions(fixVersion)
                  
        }



But this does not work, is shows that [State type checking] - Cannot find matching method. Please check if declared type is right and matching method exist.

In the API i found this:

setFixVersions

void setFixVersions(Collection<Version> fixVersions)
Parameters:
fixVersions - A collection of fix-for Version objects.

 

I am trying to set FixVersions on subIssues the same as FixVersion in parent issue when creating one.

 

2 answers

0 votes
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 Leaders.
August 16, 2018

Hello @Damian Wodziński

IssueInputParameters doesnt have method .setFixVersions()

You should use .setFixVersionIds() instead.

0 votes
Damian Wodziński August 9, 2018

Error code:

2018-08-09 12:33:03,189 ERROR [runner.AbstractScriptListener]: *************************************************************************************
2018-08-09 12:33:03,194 ERROR [runner.AbstractScriptListener]: Script function failed on event: com.atlassian.jira.event.issue.IssueEvent, file: <inline script>
groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.issue.IssueInputParametersImpl.setFixVersions() is applicable for argument types: (java.util.ArrayList) values: [[2018_R12.0]]
Possible solutions: setFixVersionIds([Ljava.lang.Long;), getFixVersionIds()
 at Script215.CreateSubIssues(Script215.groovy:62)
 at Script215.run(Script215.groovy:247)

Suggest an answer

Log in or Sign up to answer