Set value of enum field in Workflow

Hello,

I have field Priority. It's an enum field and I would like to change the value in the Workflow. The code below is for testing where I try to change the value to Urgent in case of change Stage or Swimline. Below is also message in case of moving in the kanban table.

Can somebody help me with syntax?

Thank you

 

5 comments
Comment actions Permalink
Official comment

Hello,

Since you are trying to use the Urgent value form a context is necessary to add it to the requirements section. For example:

Priority: {
type: entities.EnumField.fieldType,
name: 'Priority',
Urgent: { name: 'Urgent' }
},

If this does not help, would you please provide us with the console output from the add_watchers_to_issue/add_watchers rule?

Comment actions Permalink

Hello,

it doesn't work. There is still an exception in the Agile board.

Radovan@108.171.129.164 24 Jan 2020 08:35
Processing issue T-1:
TypeError: Cannot set property "Priority" of undefined to "{"becomesRemoved": "false",
"isNew": "false",
"$$type": "EnumField",
"toString": function() {},
"toShortString": function() {},
"required": function() {},
"becomes": function() {},
"isChanged": function() {},
"oldValue": function() {},
"canBeReadBy": function() {},
"canBeWrittenBy": function() {},
"constructor": function() {},
"backgroundColor": "#ff7123",
"foregroundColor": "#fff",
"presentation": "Urgent",
"isArchived": "false",
"colorIndex": "11",
"description": "null",
"name": "Urgent",
"ordinal": "0"}" (add_watchers_to_issue/add_watchers#12)
 
            org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4198)
            org.mozilla.javascript.ScriptRuntime.constructError(ScriptRuntime.java:4176)
            org.mozilla.javascript.ScriptRuntime.typeError(ScriptRuntime.java:4209)
            org.mozilla.javascript.ScriptRuntime.typeError3(ScriptRuntime.java:4235)
            org.mozilla.javascript.ScriptRuntime.undefWriteError(ScriptRuntime.java:4252)
            org.mozilla.javascript.ScriptRuntime.setObjectProp(ScriptRuntime.java:1726)
            org.mozilla.javascript.gen.add_watchers_to_issue_add_watchers_261489._c_anonymous_2(add_watchers_to_issue/add_watchers:12)
            org.mozilla.javascript.gen.add_watchers_to_issue_add_watchers_261489.call(add_watchers_to_issue/add_watchers)
            org.mozilla.javascript.optimizer.OptRuntime.callName(OptRuntime.java:63)
            org.mozilla.javascript.gen._execution_ctx__261501._c_anonymous_6(_execution_ctx_:88)
            org.mozilla.javascript.gen._execution_ctx__261501.call(_execution_ctx_)
            org.mozilla.javascript.ContextFactory.doTopCall(ContextFactory.java:405)
            org.mozilla.javascript.ScriptRuntime.doTopCall(ScriptRuntime.java:3508)
            org.mozilla.javascript.gen._execution_ctx__261501.call(_execution_ctx_)
0
Comment actions Permalink

Hello,

It seems you have a typo in addressing the Priority field. Please use `issue.fields.Priority` instead of `issue.field.Priority` and let us know if it helps. 
The full list of Issue properties can be found here: https://www.jetbrains.com/help/youtrack/standalone/v1-Issue.html#properties

0
Comment actions Permalink

Hello,

it works! Thank you :o)

0
Comment actions Permalink

Thank you for the update, have a nice day!

0

Please sign in to leave a comment.