0

I have declared a field of type Change as can be empty. If the state Solved has been reached, Change should be set to cannot be empty. How can I best implement this?

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

exports.rule = entities.Issue.onChange({
  guard: function(ctx) {
    return ctx.issue.fields.becomes(ctx.Stage, ctx.Solved);
  },
  action: (ctx) => {
    //TODO: here change to cannot be empty
    ctx.Change = null;
  },
  requirements: {
    Change: {
      type: entities.Field.textType
    },
    Stage: {
      type: entities.State.fieldType,
      name: 'Stage',
      Solved: {
        name: 'Solved'
      }
    }
  }
});

0 Answers0