添加链接
link管理
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Create
cancel
Showing results for
Search instead for
Sign up Log in

Hi everyone,

As for the enviroment i'm using Jira Software and the only plugin im using is ScriptRunner.

My aim is to program a post-fucntion such as in the moment i transicionate an issue to "in progress" a sub-task with the same fields is created. Also, during the transition I pick up a comment that has to be in both Task and Sub-Task.

I'm using one of the build-in scripts of ScriptRunner "Create a sub-task"

Also I added this code

import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.comments.Comment
import com.atlassian.jira.issue.comments.CommentManager
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.user.*

ApplicationUser currentUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def commentManager = ComponentAccessor.getCommentManager()
def comment = commentManager.getLastComment(sourceIssue)
commentManager.create(issue,currentUser,comment.getBody(),true)


But all I get is this message

org.ofbiz.core.entity.GenericTransactionException: Commit failed, rollback previously requested by nested transaction.

And inside the log this one :

2018-09-26 16:18:21,949 ERROR [workflow.ScriptWorkflowFunction]: *************************************************************************************
2018-09-26 16:18:21,950 ERROR [workflow.ScriptWorkflowFunction]: Script function failed on issue: COM-56, actionId: 11, file: null
java.lang.IllegalArgumentException: eq(null) is not allowed. Use isNull() instead
	at com.querydsl.core.types.dsl.SimpleExpression.eq(SimpleExpression.java:127)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.lambda$create$0(DefaultCommentManager.java:263)
	at com.atlassian.jira.database.DefaultQueryDslAccessor.lambda$execute$1(DefaultQueryDslAccessor.java:74)
	at com.atlassian.jira.database.DatabaseAccessorImpl.runInTransaction(DatabaseAccessorImpl.java:110)
	at com.atlassian.jira.database.DefaultQueryDslAccessor.execute(DefaultQueryDslAccessor.java:73)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:258)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:227)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:217)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:201)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:190)
	at com.atlassian.jira.issue.comments.DefaultCommentManager.create(DefaultCommentManager.java:179)
	at com.atlassian.jira.issue.comments.CommentManager$create$3.call(Unknown Source)
	at Script5.run(Script5.groovy:12)


I figured out the proble is with the "issue" variable used on commentManager.create, but I don't understand why?

Any Idea?

Thanks :D

Hi Xavier,

I was not able to fix this quickly but what I did is writing the comment to the description of the created sub-task and copying it in its create postfunction to a new comment using JSU (of course after the create issue postfunction). What I could imagine here is that the subtask issue is not fully created at the time these additional actions are executed and the commentManager can't add comments to a yet uncreated issue...

Best regards

Christoph

AUG Leaders

Atlassian Community Events