Hi,
we use the Behaviors plugin to copy values from story to subtask on creation.
This script is working well:
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.fields.CustomField
import com.atlassian.jira.issue.customfields.option.Option
import com.opensymphony.workflow.loader.StepDescriptor
def ComponentManager componentManager = ComponentManager.getInstance();
def issueid = getFieldById("parentIssueId").value;
def Issue parentIssue = componentManager.getIssueManager().getIssueObject(Long.parseLong(issueid));
// Check workflow ID
if (Double.parseDouble(componentManager.getWorkflowSchemeManager().getWorkflowScheme(parentIssue.getProject()).get("id").toString()) == 11600 ||
Double.parseDouble(componentManager.getWorkflowSchemeManager().getWorkflowScheme(parentIssue.getProject()).get("id").toString()) == 11601)
{
// Set Cost Unit
def FormField cu = getFieldById(getFieldChanged());
def CustomFieldManager customFieldManager = componentManager.getCustomFieldManager();
def CustomField parentcustomField = customFieldManager.getCustomFieldObjectByName("Cost Unit");
def Option parentnrd = (Option)parentIssue.getCustomFieldValue(parentcustomField);
cu.setFormValue(parentnrd.getOptionId());
// Set FixVersions
def fixVersions = parentIssue.getFixVersions();
def FormField fv = getFieldById("fixVersions");
fv.setFormValue(fixVersions*.id);
// Set Components
def components = parentIssue.getComponentObjects();
def FormField c = getFieldById("components");
c.setFormValue(components*.id);
}
Now we try the same when creating a story from an epic using the "Issues in Epic" "+" function but with no success. The information about the parent epic must be available because in the headline of the story create dialog we can see "Create issue in epic: TEST-1".
Does anyone know what we are doing wrong and how we can solve this problem?
Best regards,
Jo