Workflow. Get value of enum custom field

Hi there. I created a custom enum field (multi) and created worflow, which auto create subtask. So I need get one value from my enum field.
I find that this statement ctx.issue.fields.locales returns data with this format: 

[{"$$type": " EnumField", "name": "UK"}, 
{"$$type": " EnumField", "name": "HU"},
{"$$type": " EnumField", "name": "RO"}]

How can I get separately RO or UK or HU in my example?

code of my workflow:

* 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:

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

exports.rule = entities.Issue.onChange({
// TODO: give the rule a human-readable title
title: 'Create_task_english_text',
guard: (ctx) => {
var issue = ctx.issue;
return ctx.issue.isReported && === && === && issue.summary === 'test';
action: (ctx) => {
var issue = ctx.issue;
var newProject = entities.Project.findByName('New-Landings');

var createIssue = function() {

var newIssue = new entities.Issue(ctx.currentUser, newProject, issue.summary);

newIssue.description = ctx.issue.fields.locales + '\n';
newIssue.IssueAttachment = issue.IssueAttachment;

newIssue.applyCommand ('add Board ' + 'New projects', ctx.currentUser);
newIssue.applyCommand('work-type ' + 'Translation', ctx.currentUser);

newIssue.applyCommand ('Assignee ' + 'r.torshin', ctx.currentUser);
newIssue.links['subtask of'].add(issue);



requirements: {
Type: {
type: entities.EnumField.fieldType,
Localisation: {
name: 'localization'
New_landing: {
name: 'new landing'
Text: {
type: entities.EnumField.fieldType,
russian: {
name: 'only Russian text'
name: 'English text'
name: 'Original text'


1 comment
Comment actions Permalink


I will copy my answer from your support request here in case other users have the same question.

Since your field is a multi-value one, you need to use the forEach to get all values in it:

ctx.issue.fields.locales.forEach(function(value) {

Of course, change the console.log to the needed action.

Please do not forget to add the locales field to the requirements section:

locales: {
 name: "locales",
 type: entities.EnumField.fieldType,
multi: true

Please sign in to leave a comment.