Forums

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

Problem creating subtask within a script

Andreas Sumper
January 12, 2016

Hi all!

 

I also posted this on stackoverflow, but did not get any answer. Hopefully someone here can help me with my problem. I had this script running, but tried to remove deprecated functions. I removed almost all of them, but I am stuck on this code.

 

I am working on some groovy-scripts in jira. The script get´s triggered as a postfunction using the scriptrunner plugin. The code, that produces the error is this one:

ComponentAccessor CompAcc = new ComponentAccessor() 
SubTaskManager subTaskManager = CompAcc.getSubTaskManager() 
... 
def subTask = issueManager.createIssue(CompAcc.getJiraAuthenticationContext().getLoggedInUser(), issueObject) 
subTaskManager.createSubTaskIssueLink(issue, subTask, usera)

where issue is the issue, on which the postfunction was triggered. The subtask get´s created but not linked to the calling task.

And this is the error:

2016-01-11 11:39:39,925 http-bio-8063-exec-19 ERROR asu 699x3972x1 16m4yz4 10.1.21.129 /secure/CommentAssignIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] ************************************************************************************* 
2016-01-11 11:39:39,926 http-bio-8063-exec-19 ERROR asu 699x3972x1 16m4yz4 10.1.21.129 /secure/CommentAssignIssue.jspa [scriptrunner.jira.workflow.ScriptWorkflowFunction] Script function failed on issue: RQA-7338, actionId: 81, file: /home/qa/Tools/Jira/scripts/CreateDevTestExecutionSubtask.groovy groovy.lang.MissingMethodException: No signature of method: com.atlassian.jira.config.DefaultSubTaskManager.createSubTaskIssueLink() is applicable for argument types: (com.atlassian.jira.issue.IssueImpl, com.atlassian.jira.ofbiz.IssueGenericValue, com.atlassian.jira.user.DelegatingApplicationUser) values: [RQA-7338, [timespent:null, timeoriginalestimate:7200, project:11400, ...], ...] Possible solutions: createSubTaskIssueLink(com.atlassian.jira.issue.Issue, com.atlassian.jira.issue.Issue, com.atlassian.crowd.embedded.api.User), createSubTaskIssueLink(org.ofbiz.core.entity.GenericValue, org.ofbiz.core.entity.GenericValue, com.atlassian.crowd.embedded.api.User) at CreateDevTestExecutionSubtask.run(CreateDevTestExecutionSubtask.groovy:212)

 

So what I need to know, is how I can convert com.atlassian.jira.issue.IssueImpl andcom.atlassian.jira.ofbiz.IssueGenericValue to com.atlassian.jira.issue.Issue so that the linking of the subtask works again. Or someone can help me to explain, how I have to use the missing function.

Thanks for any help!

4 answers

1 vote
Anthony France
Contributor
December 27, 2019

Has any workaround or fix been identified for this issue as of yet?  

1 vote
Fazila Ashraf
Community Champion
August 20, 2015

When a user types "project not in" , only the projects to which he has access are listed in the auto-suggestion. So if he doesn't have access/visibility to the project , the system doesn't recognize the project name value to his level and he will not be able to use that in the JQL condition.

Access to the project do matter even though we want the results of the project to be excluded, as the JQL itself is not executable from the user's level.

I am not able to think of any other solution/workaround for this requirement at the moment. If something comes up, I will surely update you.

 

Frank Schophuizen
Contributor
August 21, 2015

You are right that I (who wrote the query filter) have access to those projects. So I had not trouble with it. But once I started sharing the filter by using it on a dashboard to make an overview of data of the remaining projects), people started complaining they could not drill down on the data because the query failed. Not all users have access to the excluded projects. Reason for excluding those projects is to avoid that they would show up on the dashboard. And they don't, but it causes problems with drill down on the projects that do show on the dashboard.

Like Robby Berner likes this
1 vote
Sateesh Chandra
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 20, 2015

The query is searching all the projects except the two listed projects. It is returning error if the user does not have access to atleast to one of the remaining projects.

Frank Schophuizen
Contributor
August 20, 2015

Incorrect. The user has access to all remaining project. If I give access to all projects, the query works. When I remove access to HIVV, the query fails.

Like Robby Berner likes this
0 votes
J K
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
February 7, 2020

I can't believe that all users who share a filter with project keys must have the same project rights. 

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events