I am using the ScriptRunner post function "Create Sub-Task," and I am trying to find a way to set the Reporter of the sub-task based on a custom value field called Cost Center Manager. This is a user-picker field type.
My current script is as follows:
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.Issue
def value = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Cost Center Manager").getValue(issue)
issue.summary = issue.issueType.name + ' Tasks: ' + sourceIssue.summary
issue.description = 'In the DETAILS section above, please review the list of requested devices, applications, and systems for ' + sourceIssue.summary + '. Once approved, advance through the workflow as you implement the requested changes, verify the changes, and resolve the issue.'
issue.reporterId = value
checkLink = {link -> false};
Hello @Gavin Minnis
There is an error in your code. When you get customfieldvalue, you get it from subtask issue, where it is null.
You must get it from parent:
def value = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Cost Center Manager").getValue(sourceIssue)
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.