gantt chart questions

Is there a way to make sure that by creating a ticket on an agile board linked to a project it is also shown in the Gantt Chartlinked to the same project?

0
1 comment

This scenario can be automated using a custom workflow created in JS. Here is an example:

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

exports.rule = entities.Issue.onChange({
  title: 'Place cards on Gantt chart',
  guard: (ctx) => {
    return ctx.issue.becomesReported;
  },
  action: (ctx) => {
    const issue = ctx.issue;
    const agilesByName = entities.Agile.findByName("Agile Board Name");
    const agileContainsIssue = (agilesByName.isNotEmpty() && agilesByName.size === 1) ? agilesByName.first().containsIssue(issue) : false;
   
    if (agileContainsIssue) {
      const gantt = entities.Gantt.findChartByName("Gantt Chart Name");
      gantt.addIssue(ctx.issue);
    }
  },
  requirements: {
  }
});

Project Name, Agile Board Name, and Gantt Chart Name should be replaced with actual names in your instance. This script will be triggered upon issue creation, and it will then check if the agile board contains the issue being created. If it does, it will assign it to the Gantt chart. 

To learn more about creating workflows in JS, feel free to check out our Developer Portal: Using the Workflow API; JavaScript Workflow Reference.

0

Please sign in to leave a comment.