Hi Pro!
Please advise,
How to add Assignee value from subtask into parent (inside of multi-picker user field) with script (according with issue update event)?
Any script?
Thanks!
Community moderators have prevented the ability to post new answers.
You can use misc work flow extensions for this requirement.
https://marketplace.atlassian.com/plugins/com.innovalog.jmwe.jira-misc-workflow-extensions
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried to write a script:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.event.issue.AbstractIssueEventListener import com.atlassian.jira.event.issue.IssueEvent import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.issue.IssueManager import com.atlassian.jira.issue.ModifiedValue import com.atlassian.jira.issue.MutableIssue import com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem import com.atlassian.jira.issue.util.DefaultIssueChangeHolder import com.atlassian.jira.user.ApplicationUser class IssueAssignedListener extends AbstractIssueEventListener { @Override void issueAssigned(IssueEvent event) { IssueManager issueManager = ComponentAccessor.getIssueManager(); MutableIssue issue = issueManager.getIssueObject(event.issue.getId()); //Issue issue = event.issue if (issue.isSubTask()) { parentIssueObject = issue.getParentObject(); if (parentIssueObject.getIssueTypeObject().getName().equals("SoW")){ BackupApprover = "customfield_12810"; Approvers = "customfield_15910"; CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager(); customFieldBackupApprover = customFieldManager.getCustomFieldObject(BackupApprover); customFieldApprovers = customFieldManager.getCustomFieldObject(Approvers); assignee = issue.getAssignee(); SubIssueBackupApproverValue = issue.getCustomFieldValue(customFieldBackupApprover); SubIssueApproversValue = issue.getCustomFieldValue(customFieldApprovers); FieldLayoutItem fieldLayoutItem = ComponentAccessor.getFieldLayoutManager().getFieldLayout(issue).getFieldLayoutItem(customFieldApprovers); DefaultIssueChangeHolder issueChangeHolder = new DefaultIssueChangeHolder(); //List<ApplicationUser> addValue = getListUser(assignee); List<ApplicationUser> addValue = new LinkedList<ApplicationUser>(); ApplicationUser applicationUser = ComponentAccessor.getUserManager().getUserByName(assignee.getName()); addValue.add(applicationUser); addValue.removeAll(Collections.singleton(null)); //for(value in SubIssueApproversValue) { customFieldApprovers.updateValue(fieldLayoutItem, issue, new ModifiedValue(SubIssueApproversValue, addValue), issueChangeHolder) //} ComponentAccessor.getIssueIndexManager().reIndex(issue); } } } }
But currently nothing happens when i updating current fields. May be something wrong? ( I did not use script fields)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi! Thanks for feedback, but is really need to copy value w/o workflow transition. Please advise. Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Personaly, i don't use script. Just the copy field to parent post-function.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Community moderators have prevented the ability to post new answers.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.