How can I update the description based on priority?

I've setup "Show-stopper" tickets to page whoever is oncall.  Before publicizing this, I'd like to somehow notify the user that someone will be paged to ensure the issue is worthy of waking someone up.  My best guess in how to do so is to add an entry to the description.  I'm using the following workflow but it never works unless I remove issue.priority === 'Show-stopper'

 

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

exports.rule = entities.Issue.onChange({
title: workflow.i18n('Insert default description template for external users'),
guard: function(ctx) {
var issue = ctx.issue;
return !issue.isReported && !issue.becomesReported && issue.priority === 'Show-stopper' && issue.description === null;
},
action: function(ctx) {
ctx.issue.description = workflow.i18n('WARNING: By setting the Priority to Show-stopper, someone will be paged. Please only do so for cases such as a customer facing outage.') +
"\n";
},
requirements: {}
});

4 comments
Comment actions Permalink

Hello,

Please attach a screenshot of Project -> your project -> Edit project -> FIelds -> priority.

Also, please try changing `issue.description === null` to `!issue.description` in guard condition. Does it help?

0
Comment actions Permalink

Unfortunately, changing `issue.description === null` to `!issue.description` in guard condition didn't have any effect.

0
Comment actions Permalink

Fields names are case sensitive, so please use issue.Priority instead of issue.priority. 

Please let me know if it helps. 

0

Please sign in to leave a comment.