Unable to set Due Date in workflow

After trying for several hours to attach a DueDate when creating an Issue automatically with a workflow i hope i will find the answer here ...

I want to create a reminder issue on a weekly basis (every minute for test purposes):
While it creates the Issue itself just fine and fills the Subsystem and State fields the Due Date field always stays empty - am i overlooking something obvious here?
Im following this guide https://www.jetbrains.com/help/youtrack/incloud/generate-issues-automatically-workflows.html#generate-issues-on-schedule and it looks like im doing the same ...

Thanks in advance

var entities = require('@jetbrains/youtrack-scripting-api/entities');

var DAY_IN_MS = 24 * 60 * 60 * 1000;

exports.rule = entities.Issue.onSchedule({
title: 'Creator',
search: '#PRB-1',
//cron: '0 0 6 ? * MON',
cron: '0 0/1 * * * ?',
muteUpdateNotifications: true,
guard: function(ctx) {
return true;
},
action: function(ctx) {
var date = new Date(Date.now() + 5 * DAY_IN_MS);

var blog = new entities.Issue(ctx.currentUser, ctx.issue.project, 'Write BlogPost');
blog.fields.Subsystem = ctx.Subsystem.Blogpost;
// blog.fields.DueDate = Date.now(); // doesnt work
// blog.fields.DueDate = date; // doesnt work
blog.fields.DueDate = date.getTime(); // doesnt work
},
requirements: {
Subsystem: {
type: entities.OwnedField.fieldType,
Blogpost: {}
},
DueDate: {
type: entities.Field.dateType,
name: 'Due Date'
},
prb: {
type: entities.Issue,
id: 'PRB-1'
}
}
});


3 comments
Comment actions Permalink
Official comment

Hello,

Since you are creating a new issue that is outside the context, would you please try to use the following syntax: 

blog.fields['Due Date'] = date.getTime(); 

Should you have any further questions, feel free to contact us.

Comment actions Permalink

Thanks that worked.

May is suggest updating the syntax on the linked help page?

 

0
Comment actions Permalink

You are welcome!

I have created a separate https://youtrack.jetbrains.com/issue/RDOC-1485 task for this. Please feel free to vote for this to increase its priority and to receive the updates.

0

Please sign in to leave a comment.