Hi ,
I need the code for Copy the value of two user-pickers custom field values into another custom field which is a multi user picker.
ex: CF1: user1, CF2: user2 and for CF3 the value should be as "user1,user2". CF3 is a User Picker (multiple users).
Note: CF3 will be empty during creation of issue. during the flow of issue once CF1 and CF2 gets values by the code CF3 should populate the merged value.
I tried with this below code but not worked :(
package UpdateIssue
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.UpdateIssueRequest
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.project.Project
import com.atlassian.jira.user.ApplicationUser
import com.atlassian.jira.issue.ModifiedValue
IssueManager issueManager = ComponentAccessor.getIssueManager();
MutableIssue issue = issueManager.getIssueObject("TKT-16")
if (issue)
{
CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();
CustomField cstFld1 = customFieldManager.getCustomFieldObject("Customfield_1123")
CustomField cstFld2 = customFieldManager.getCustomFieldObject("Customfield_1123")
CustomField cstFld3 = customFieldManager.getCustomFieldObject("Customfield_1144")
ApplicationUser curUser = ComponentAccessor.getJiraAuthenticationContext().getUser();
UpdateIssueRequest updateIssueRequest = new UpdateIssueRequest(new UpdateIssueRequest.UpdateIssueRequestBuilder().eventDispatchOption(EventDispatchOption.ISSUE_UPDATED).sendMail(false))
// issue.setCustomFieldObject(cstFld1.getValue(issue).toString() + "," + cstFld2.getValue(issue).toString())
def CR = (cstFld1.getValue(issue).toString() + "," + cstFld2.getValue(issue).toString())
def changeHolder = new DefaultIssueChangeHolder()
cstFld3.updateValue(null, issue, new ModifiedValue(cstFld3,CR),changeHolder)
}
Getting this error
I know why i get this error because
cstFld3 is Customfield with user picker and CR is a string value, but don't know how to make string to custom field value(user picker).
Could some one help me on it.
Thanks in advance
Can some one help me on this ?
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.