Add an issue to an agile board

I want to add an issue when a fix version is set to the issue. I've created a workflow script:

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

exports.rule = entities.Issue.onChange({
  // TODO: give the rule a human-readable title
  title: 'Add issue to the release board',
  guard: (ctx) => {
    return ctx.issue.isChanged("Fix versions");
  },
  action: (ctx) => {
    ctx.issue.boards.add("Release board"); // ???
    // TODO: specify what to do when a change is applied to an issue
  },
  requirements: {
    // TODO: add requirements
  }
});

I know from the documentation that the boards field is Read-Only. How I can add a board to an issue?

1 comment
Comment actions Permalink

Hi!

You can use the applyCommand() method to add a card to the board, e.g., issue.applyCommand ('add Board ' + board.name, ctx.currentUser);

0

Please sign in to leave a comment.