Forums

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

Getting Cannot find matching method com.atlassian.jira.issue.MetableIssue#getSubTaskObject()

kdickason
Contributor
February 15, 2022

I need help with a script, please.  I have to provide a screen cap, because it is on a network that is not connected to the Internet.  

The goal of this script is to transition the Status of an Issue's subtask back to a previous status ("Back to Draft")  when the Issue is transitioned backward in its workflow.  I have the script as a Post function in the Issue's workflow--so it executes when the Issue's workflow transitions backward.  I am getting an error "Cannot find matching method..." see the attached screenshot.  Please help!

back_to_draft.png

 

2 answers

1 accepted

1 vote
Answer accepted
Fabio Racobaldo _Catworkx_
Community Champion
February 15, 2022

Hi @kdickason ,

that method return a Collection of Issue and not of MutableIssue (https://docs.atlassian.com/software/jira/docs/api/8.5.1/index.html?com/atlassian/jira/issue/Issue.html).

Your code should be :

Collection<Issue> subTasks = issue.getSubTaskObjects();

This should fix your issue.

Fabio

kdickason
Contributor
February 15, 2022

I made your change, thank you.  On Line 21, I am getting error, "The variable [issue] is undeclared."  Also on Line 22 it says, "Expected parameter of type com.atlassian.issue.Issue but got com.atlassian.jira.issue.MutableIssue.  So something is screwed up on Line 22.  I'm obviously very inexperienced--I inherited this script from someone.  Thank you for your help.

Fabio Racobaldo _Catworkx_
Community Champion
February 15, 2022

@kdickason , change MutableIssue with Issue on line 22

kdickason
Contributor
February 15, 2022

Okay, that fixed line 22.  I also removed the -> at the end of line 22 (that didn't look right).  Line 21 is still complaining about the variable [issue] is undeclared with a red x in the script editor.  Anything I can do for that?  Thank you again and again...

Fabio Racobaldo _Catworkx_
Community Champion
February 15, 2022

Are u using Script Console?

Fabio Racobaldo _Catworkx_
Community Champion
February 15, 2022

If you use a Custom script post-function "issue" should automatically associated to issue in which you perform the transition ;)

kdickason
Contributor
February 15, 2022

okay, I'll give i a whirl.  Thank you soooooo much.

Fabio Racobaldo _Catworkx_
Community Champion
February 15, 2022

@kdickason , please mark my answer as accepted :)

0 votes
kdickason
Contributor
February 15, 2022

I have it within the workflow as a post function at the moment.

Suggest an answer

Log in or Sign up to answer