Setting fields on generated Issue does not work.

I have a single-valued enum field called Issue Type that can be either Epic or Task. When I create an Epic I want to auto-generate some tasks underneath it. The issues are generated but I am unable to set the value of Issue Type to Task. What am I doing wrong?

var newIssue = function(ctx, summary){
return new entities.Issue(ctx.currentUser, ctx.issue.project, summary);

exports.rule = entities.Issue.onChange({
title: 'On-create',
guard: function(ctx) {
var issue = ctx.issue;
return issue.isReported && issue.becomesReported && ==;;
action: function(ctx) {
var subtasks = [
newIssue(ctx, "Part A"),
newIssue(ctx, "Part B"),
newIssue(ctx, "Part C")

for(var i=0; i<subtasks.length; i++){
subtasks[index].fields.IssueType = ctx.IssueType.Task; // this does not work, it's generated as an Epic.

// this line claims that it is set to Task, but it is generated as Epic.
requirements: {
IssueType: {
name: 'Issue Type',
type: entities.EnumField.fieldType,
Epic: {},
Task: {}


Comment actions Permalink


Could you please share a screenshot of Projects -> your project -> Edit project -> Fields -> IssueType page? 

Thank you. 

Comment actions Permalink

Could you please add two lines inside of the "for" loop and show me the output?




Please sign in to leave a comment.