How to set a default value for a text field that is not the description ?


I succedeed in setting a default text to the "description" field (that is out-of-the-box).

Same thing for the "summary" field.

Then I added new text fields, just like the description field. Let's call them "field 2" and "field 4".

I wanted to set a default value for these fields. I used the same out-of-the-box workflows that work for default field.

But it doesn't as I expected.

Could you help me please?

in the "guard" function, the "if" condition is always false, so it goes to the "ELSE" block all the time.

the "action" function is executed, but the field remains unchanged in the UI...

Thank you very much !

* This is a template for an on-change rule. This rule defines what
* happens when a change is applied to an issue.
* For details, read the Quick Start Guide:

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

exports.rule = entities.Issue.onChange({
// TODO: give the rule a human-readable title
title: 'default text',
guard: function(ctx) {
var issue = ctx.issue;
if (issue.actionField === null) {
} else {
return true;
action: function(ctx) {
var issue = ctx.issue;
var descrActions = "my de fault value...";
issue.field4= descrActions;
issue.field2 = descrActions;
requirements: {
field4: {
type: entities.Field.textType,
name: 'Field 4'
field2: {
type: entities.Field.textType,
name: 'Field 2'

Comment actions Permalink

I found out.

We have to use this syntax:

issue.fields["Field 4"] = "My text here...\nthat's all.";

instead of:

issue.field4 = "My text here...\nthat's all.";


Comment actions Permalink


Thank you for sharing the solution. You are absolutely right. Please let us know if you have any further questions. 


Please sign in to leave a comment.