I have a transition screen with a custom field (with type, User Picker (single user), I called it "Internal User"). I also have a post function for this transition that creates a sub-task. I would like the post function to set the assignee of the sub-task to the custom field value of "Internal User".
Here is what I have so far:
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def customfieldname = customFieldManager.getCustomFieldObjectByName("Internal User")
def valueofcustomfield = issue.getCustomFieldValue(customfieldname) as ApplicationUser
The new sub-task is being created, but it is unassigned every time.
I am using script runner version 5.4.12.
I am using JIRA version 7.10.2.
The method you are calling to set the assignee (setAssigneeId) is expecting a user id as its parameter and you are giving it a username instead. I would suggest using the setAssignee method instead, like so:
Also make sure that your post function (the one, that creates sub tasks) is placed last in the post functions list in your transition. That way you'll ensure that it's executed after your main issue has been updated with the value for your custom field and so the assignee of your sub task will be set correctly.
Jira is a great tool to use across different departments. Forget that paperwork – switch to Jira and get that tasks done smoothly. Marketing Jira allows for a complete digital transformation of you...
Connect with like-minded Atlassian users at free events near you!Find an event
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.Host an event
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events