Set a Custom Description Based on Team Group

I try setup Custom Description based on Team Group but it dont work.

Code type:

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

exports.rule = entities.Issue.onChange({
title: workflow.i18n('Insert default description template for QA external users'),
guard: function(ctx) {
var issue = ctx.issue;
return !issue.isReported && !issue.becomesReported && issue.description === null;
},
action: function(ctx) {
ctx.issue.description = workflow.i18n('Описание проблемы:') +
"\n\n" +
workflow.i18n("Воспроизведение по шагам:") +
"\n1.\n2.\n3.\n\n" +
workflow.i18n("Ожидаемый результат:") +
"\n\n" +
workflow.i18n("Визуальная Локация:") +
"\n\n" +
workflow.i18n("Программная Локация:") +
"\n\n" +
workflow.i18n("Заметки:") +
"\n\n";
},
requirements: {

OurTeam: {
type: entities.UserGroup,
name: 'QA'
}

});

7 comments
Comment actions Permalink

Hello Sergey.

You lost one " } " and specified the wrong type

Information about types here.

requirements: {

OurTeam: {
type: entities.UserGroup.fieldType,
name: 'QA'
}
}
});
0
Comment actions Permalink
I need the description to work only for a specific group of users. since now it works for everyone
0
Comment actions Permalink

In "requirements", you need to specify which fields and their values are required for the project. You don't need it.

Add a condition to guard:

ctx.CurrentUser.isInGroup("QA");
0
Comment actions Permalink

This temp not work too

 

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

exports.rule = entities.Issue.onChange({
title: workflow.i18n('Insert default description template for QA external users'),
guard: function(ctx) {
var issue = ctx.issue;
return !issue.isReported && !issue.becomesReported && issue.description === null;
},
action: function(ctx) {
if (entities.UserGroup('QA')) {
ctx.issue.description = workflow.i18n('Описание проблемы:') +
"\n\n" +
workflow.i18n("Воспроизведение по шагам:") +
"\n1.\n2.\n3.\n\n" +
workflow.i18n("Ожидаемый результат:") +
"\n\n" +
workflow.i18n("Визуальная Локация:") +
"\n\n" +
workflow.i18n("Программная Локация:") +
"\n\n" +
workflow.i18n("Заметки:") +
"\n\n";
}

},


requirements: {

}
});

0
Comment actions Permalink

...

return !issue.isReported && !issue.becomesReported && issue.description === null && ctx.currentUser.isInGroup("QA");

action: function(ctx) {
ctx.issue.description = workflow.i18n('Описание проблемы:') +
"\n\n" +

...

1
Comment actions Permalink

You are welcome!

0

Please sign in to leave a comment.