hi Community,
I've been stuck on following task for some time now; could anyone please point me to the right direction? thanks!
System info:
JIRA Data Center 8.5.6
Adaptive Scriptrunner: 6.22.0
Objective:
Clone an issue from ProjectA to ProjectB, upon closing the issue from ProjectA, a single select list (None, User 1, User 2, User 3) shows up on the close screen; if None is selected, nothing happens; otherwise, if User 1 or User2 or User3 is selected, the assignee on the cloned/new issue (projectB) will be the selected user (from single select list)
Current Status:
Cloning is working; however assignee in new issue (projectB) is not functional
Post Function:
Condition:
cfValues['Design QA Owner']?.value
Additional issue actions:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.user.util.UserManager
import com.atlassian.jira.event.type.EventDispatchOption
import com.onresolve.jira.groovy.user.FieldBehaviours
import groovy.transform.BaseScriptUserManager userMgr = ComponentAccessor.getUserManager()
IssueManager issueMgr = ComponentAccessor.getIssueManager()
ApplicationUser currUser = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()def designQAOwner = ComponentAccessor.getCustomFieldManager().getCustomFieldObject("customfield_12818")
def selectedValue = designQAOwner.getValue(issue) as Stringdef user
if (selectedValue == "User 1"){
user = userMgr.getUserByName("test_user1")
}else if (selectedValue == "User 2"){
user = userMgr.getUserByName("test_user2")
}else if (selectedValue == "User 3"){
user = userMgr.getUserByName("test_user3")
}issue.setAssignee(user)
Logs:
2021-04-07 15:11:01,809 DEBUG [utils.ConditionUtils]: Condition did not return a boolean, coercing to true
2021-04-07 15:11:01,809 DEBUG [utils.AbstractCloneIssue]: System fields to copy: [description, summary]
2021-04-07 15:11:01,816 DEBUG [utils.AbstractCloneIssue]: Custom fields to copy: []
2021-04-07 15:11:01,885 DEBUG [utils.AbstractCloneIssue]: Run As User hlin(hlin)
2021-04-07 15:11:01,917 ERROR [recordparser.RecordParserUtils]: commentId is null
regards,
Henry
Hi @Henry Lin ,
From this line, you are trying to retrieve the select list value from the clone issue:
def selectedValue = designQAOwner.getValue(issue) as String
To get the original issue object information, please use sourceIssue (instead of issue):
def selectedValue = designQAOwner.getValue(sourceIssue) as String
This same apply on getting the reporter and assignee user of the original issue:
sourceIssue.assignee
sourceIssue.reporter
To add the those users, you can use refer to the example of the community link here.
I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi @Martin Bayer _MoroSystems_ s_r_o__ , @Nic Brough -Adaptavist-
@Lee Wonnacott, could you please take a look at this request? appreciate in advance!
regards,
Henry
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.