Problems accessing customs fields

Hi I'm currently in the process of rewriting some of our workflows for the 2019.3 version of youtrack.


I have several custom some enums , some strings & some dates. It doesn't matter which I try to access I can't get any of them to return a value even though they are all set.


For example I have a field called Request State that can be either Authorized, Acknowledged or Rejected

in the code below I would get two problems depending which is uncommented.


guard: function(ctx) {
 var becomesAuthorisation = ctx.issue.fields.becomes(ctx.issue.fields.RequestState , ctx.RequestState.Authorised); // This returns me an error saying 

// Cannot read property "Authorised" from undefined

var issue = ctx.issue;
var test = issue.RequestState;

var test = issue.field.RequestState;

workflow.message (test);


// The above 4 lines will display a message saying "undefined".  I would expect it to say "Acknowledged".  It doesn't matter however what method I use to read the field set it to the message displayed is the same. I can't see looking at other posts what I have done wrong.  

return becomesAuthorisation ; 


I haven't added anything to the requirements section, however based on what I've read I shouldn't need to.  Can someone point me to where I have gone wrong please?


Comment actions Permalink
Official comment


Would you please make sure that the RequestState field is defined in the requirements section? Please refer to the Issue Property Combinations default workflow that illustrates how to check the custom field value. The JavaScript Workflow Quick Start Guide and Using the Workflow API articles may be also helpful for you. 

Should you have any further questions, feel free to contact us.

Comment actions Permalink

So the field I have is the following


Field Name :  Leave Request State 

Default Value Received 

Type:  state
Aliases :  RequestState 
The 4 possible values are Received, Acknowledge, Approved & Objected.
based on that and following the tutorial and the articles you linked to I think the requirements should be 

requirements: {

RequestState: {
type: entities.State.fieldType,
name: 'Leave Request State',
Received: {},Acknowledged: { },Authorised: {},Rejected: { }



now when I try and change the Request State I get the following message

No field with name Received found for type Issue 

Received is interchangeable with the other values.
 What have I missed out?
Comment actions Permalink


Thank you for the clarification. Would you please make sure that you do not have applied state-machine rule that prevents setting the Received value?

Comment actions Permalink

it's not a state machine rule.


Basically I'm trying to rewrite an old rule that needs updating that was done in the old workflow language.  I tried to use your convertor but it failed to convert it.

The old rule started


rule Send notification request authroised
when issue Leave Request State becomes (Authorised)
assert issue  taskStartDate != null "You cannot set the state to authorized if the TaskStartDate is not set";
assert issue task EndDate != null "You cannot set the state to authorized if the TaskEndDate is not set";
assert issue Leave Request State oldValue =={Acknowledged}:"You cannot set the state to authorized until is has been Acknowledged.";

both the old rule and the new one are of an On Rule type and there is no state machine setting on it.  I'm sure I'm missing something obvious but it currently escapes me.

Comment actions Permalink


I appreciate everyone is very busy at the moment.  However is there any advice that you could give me.  I've followed everything off this website and I'm unable to progress this any further





Comment actions Permalink

Hello Paul,

Please accept my apologies for the delayed response. Would you please disable your "Send notification request authroised" rule and test the first one? Also, would you please provide us with a screenshot that shows the current project's Workflow page? Your cooperation is greatly appreciated. 


Please sign in to leave a comment.