最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

youtrack - How to make work type required during time entry - Stack Overflow

programmeradmin3浏览0评论

We would like to categorize better time spent and currently work type is not required when entering time. How do we enforce it?

Would be nice to require description as well. I checked general time entry settings, and checked project level. It allows to add/remove fields but there is nowhere about making it required

We would like to categorize better time spent and currently work type is not required when entering time. How do we enforce it?

Would be nice to require description as well. I checked general time entry settings, and checked project level. It allows to add/remove fields but there is nowhere about making it required

Share Improve this question asked Mar 14 at 19:56 katitkatit 17.9k36 gold badges135 silver badges267 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

To achieve this, you can create a custom workflow written in JS that will use the workflow.check() method. This will prevent the transaction when the requirement is not met.

Here is an example:

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

exports.rule = entities.Issue.onChange({
  title: 'Require-work-item-type',
  guard: (ctx) => {
    const issue = ctx.issue;
    return issue.workItems.added.isNotEmpty();
  },
  action: (ctx) => {
    const issue = ctx.issue;
    const workItem = issue.workItems.added.first();
    let hasWorkItemType = workItem.type ? true : false;
    workflow.check(hasWorkItemType, 'Work item type is required!');
  },
  requirements: {
    
  }
});
发布评论

评论列表(0)

  1. 暂无评论