【问题标题】:YouTrack Workflow reset field valueYouTrack Workflow 重置字段值
【发布时间】:2018-02-07 22:53:01
【问题描述】:

我有一个适用于 YouTrack 的 JavaScript 工作流,当一个问题设置为打开时,应该将几个字段重置为“null”。这是我用来完成此操作的代码:

Open: {
  onEnter: function (ctx, issue) {
    issue.fields['Alpha Approved By'] = null; // <- This is where the error points
    issue.fields['UAT Approved By'] = null;
    issue.fields['QA Approved By'] = null;
    issue.fields['PM Approved By'] = null;
  },
  transitions: {
    Working: {
      targetState: 'In Progress'
    },
    Rejected: {
      targetState: 'Rejected'
    }
  }
},

但是,每当我尝试创建问题时,都会收到以下错误消息: TypeError: Cannot read property "fields" from undefined (workflow-enforcement/workflow-enforcement#20)

第20行在代码sn-p中标注了注释

我应该如何设置这些字段的值?

【问题讨论】:

    标签: youtrack


    【解决方案1】:

    issue 是上下文对象 (ctx) 的一部分,而不是参数。所以代码应该是这样的:

    onEnter: function (ctx) { var issue = ctx.issue; issue.fields['Alpha Approved By'] = null; ... }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-11-27
      • 1970-01-01
      相关资源
      最近更新 更多