how to set the default assignee when creating a new issue

Hello

Is there a simple way to automatically  set the default assignee when creating a new issue to the person who created the issue? 

In our case, people usually log their own tasks and they will later handle the issues.

Currently when I create a new issue, the default value is "unassigned".
Using a single default assignee (i.e. John Doe) is same as having no default assignee.

thanks in advance!

4 comments
Comment actions Permalink

Hello,

This can be achieved via workflows.

Here is a simple on-change workflow rule that checks that the issue is created and copies the issue reporter to the "Assignee" field:

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

exports.rule = entities.Issue.onChange({
title: 'Reporter-assignee',
guard: function(ctx) {
var issue = ctx.issue;
return issue.becomesReported;
},
action: function(ctx) {
var issue = ctx.issue;
issue.fields.Assignee = issue.reporter;
},
requirements: {
Assignee: {
type: entities.User.fieldType
}
}
});
0
Comment actions Permalink

thank you very much! tested and works!

0
Comment actions Permalink

Hi there, 
I came across this question because I had the same requirement from our project management. 

I just wanted to let you (and everyone who might come across this) know, that there is a catch. When you create an issue and do select an assignee, it overwrites the selection when you click create and the reporter is set again as the assignee. 

Best,

Maggie

0
Comment actions Permalink

Hello Maggie,

You are right. If you wish to be able to select the Assignee during the creation of the issue, then you need to change the guard section to the following one: return issue.isChanged(ctx.Assignee) && ctx.issue.fields.Assignee && issue.isReported; After that, the workflow will be triggered only when the Assignee is changed in the created issue.

0

Please sign in to leave a comment.