Snippets

Adaptavist Create Sub Task Get Assignee From User Picker Field On Parent Issue

Created by Kristian Walker
/*
 * "The code below should be added to the 'Additional Code' box on the Create subtask postfunction in order to set the assignee on the subtask to the assignee specified in the user picker field on the parent issue 
 * All right, title and interest in this code snippet shall remain the exclusive intellectual property of Adaptavist Group Ltd and its affiliates. Customers with a valid ScriptRunner 
 * license shall be granted a  non-exclusive, non-transferable, freely revocable right to use this code snippet only within their own instance of Atlassian products. This licensing notice cannot be removed
 * or amended and must be included in any circumstances where the code snippet is shared by You or a third party." 
 */
 
// Update the ID of the *customfield_12345* below to be the id for your user picker field in order to extract the users accountId from it to set as the assignee. 
def userPickerFieldAssignee = issue.fields.customfield_12345.accountId
// Set the assignee of the subtask from the value selected from the user picker custom field specified
subtask.fields.assignee = [id:"${userPickerFieldAssignee}"] as Map

Comments (0)

HTTPS SSH

You can clone a snippet to your computer for local editing. Learn more.