Default Description
This workflow inserts default text into the description field of a new issue.
Name | @jetbrains/youtrack-workflow-default-description |
---|---|
Auto-attached | no |
Modules | Insert default description template (on-change rule) |
Use Case
This workflow provides users with a default description template for reporting issues.
Modules
When a user starts to report an issue, the on-change rule in this module checks the description field. If the description is empty, default text is inserted. The default text is inserted as soon as the user starts writing the summary or sets the value of an issue field. If the user immediately enters text in the Description field, the default text is not inserted.
Insert default description template
const entities = require('@jetbrains/youtrack-scripting-api/entities');
const workflow = require('@jetbrains/youtrack-scripting-api/workflow');
exports.rule = entities.Issue.onChange({
title: 'Insert default description template',
guard: (ctx) => {
const issue = ctx.issue;
return !issue.isReported && !issue.becomesReported && issue.description === null;
},
action: (ctx) => {
ctx.issue.description = `
ps will reproduce the problem?
1.
2.
3.
the expected result?
pens instead?
rovide any additional information below.
a screenshot if possible
`;
},
requirements: {}
});
warning
Localized MessagesThe original workflow script provided by YouTrack uses the
workflow.i18n
function. This is an internal function that is only meant to be used to reference localized message strings. To ensure that you can copy and customize this workflow code, we have removed this function from the sample. We've also cleaned up the description template to make it easier to customize.If you are editing the default workflow and want to customize any message text, we recommend that you remove these functions from your code as well.
To learn more about localized messages in workflows, see Localized Workflow Messages.