I'm using Jira and the Script Runner plugin to Create a sub-task on transition. That's all working well. However, I cannot seem to set the 'Assignee' of the Subtask to match the value of the 'Project Manager' listed on the parent (which is a custom field). Below is what I am using, But it does not work. What is the correct way to write this?:
issue.assignee = transientVars["originalissueobject"].cfValues['Project Manager']
I've Seen similar posts like this and this but nothing that shows how to Set the Assignee of a Sub-task based on the the Custom Field Value of the Parent Issue. Thanks for you Help!
@Alejo Villarrubia [Adaptavist], you were definitely on the right track. I wasn't able to get your script to work, but I found a very similar script here that worked perfectly! Thank you so much for your help!
import com.atlassian.jira.user.ApplicationUsers cfParent = customFieldManager.getCustomFieldObjectByName('Project Manager') parentMyFieldValue = transientVars["issue"].getCustomFieldValue(cfParent) issue.setAssignee(ApplicationUsers.toDirectoryUser(parentMyFieldValue))
Hi @Michael Romrell,
Can you try this out?
import com.atlassian.jira.component.ComponentAccessor def projectManagerCF = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Project Manager") def projectManager = issue.getCustomFieldValue(projectManagerCF) if (projectManager) { issue.setAssigneeId(projectManager) }
Hope it helps
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you for your reply!! To Do that, I Assume that I would add this as a post function on the "Create" Transition of my sub task (Via Script Runner's). The only issue is that I don't have direct access to upload my own script files (That requires lots of bureaucracy). Is there another way I can try out your script?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No problem. There is no need to upload the script actually. You can simply replace the code that your instance already has in the "Additional issue actions" with the one I shared.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, It isn't working (It won't create a subtask with that script in place). To be verify that I'm adding it to the right place. The script is going in the "Additional Issue Actions" field of Script Runner's "Create Sub-Task" Post Function which is tied to the parent transition. Is that correct? ---- I should also mention that the plugin, MISC JIRA Worflow's "Copy Value From Other Field" Post function performs the exact task that I need, however, I cannot get that, or any, post function to work on the subtask's "Create" Transition. but on any other subtask transition, that particular post function will actually assign the Subtask based on the custom field value of the parent.
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.