I was able to piece together a script that generates multiple sub tasks when the parent issue is created. That being said, I need to be able to transfer some of the fields from the parent issue over to the sub tasks but have not been able to do so.
I used the lines below as suggested by other posts with no success.
//def custom fields
def cf_SepDate = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Separation Date")
def cf_Position = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Position Series & Grade")
def cf_reason = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Reason For Separation")
//custom fields values
def cfv_SepDate = issue.getCustomFieldValue(cf_SepDate) as Date
String cfv_Position = issue.getCustomFieldValue(cf_Position)
Option cfv_reason = (Option) issue.getCustomFieldValue(cf_reason)
//creates the subtask
MutableIssue newSubTask = issueFactory.getIssue()
newSubTask.setSummary(summary)
newSubTask.setParentObject(parentIssue)
newSubTask.setProjectObject(issue.getProjectObject())
newSubTask.setDescription(parentIssue.description)
ApplicationUser userA = ComponentAccessor.getUserManager().getUserByName(assignee[i])
log.warn("Assigned User: " + userA.displayName)
newSubTask.setAssignee(userA)
newSubTask.setReporter(userA)
newSubTask.setIssueTypeId(constantManager.getAllIssueTypeObjects().find{it.getName() == issuetypes[i]}.getId())
Map<String,Object> newIssueParams = ["issue" : newSubTask] as Map<String,Object>
issueManager.createIssueObject(user, newIssueParams)
subTaskManager.createSubTaskIssueLink(parentIssue, newSubTask, user)
/*below are the lines of code that I am having issues with.
newSubTask.setCustomFieldValue(cf_SepDate, cfv_SepDate)
newSubTask.setCustomFieldValue(cf_Position, cfv_Position)
newSubTask.setCustomFieldValue(cf_reason, cfv_reason)
Is there any other way to transfer these fields without the use of add-ons? Jira is not showing any error message when the script runs.
Thanks in advance for any help