Access of State list in project.
I want to access the list of possible states in a project or crosscheck also if current state is equal to a specific state.
I seems that if i uses
issue.becomes('State','next state name')
I can get true or false but i want to do it using an enumerated way.
I see that i can check with:
ctx.State.{state}.name
and example is
issue.fields.State.name == ctx.State.Open.name
In this i get error that Open does is not defined.
Based on your workflow examples on the dependency example you have inside the guard.
return ctx.issue.fields.becomes(ctx.State, ctx.State.Fixed) && ctx.issue.links['depends on'].isNotEmpty();
In my case even ctx.State is undefined when you place it in workflow.message(ctx.State)
In your documentation
you have example:
-
For fields that store single values, you can reference the value directly:
const state = issue.fields.State; issue.fields.State = ctx.State.Open; if (issue.fields.State.name === ctx.State.Fixed.name) { // Do stuff }
But from what i am saying above it does not work.
Please sign in to leave a comment.
this is problem of requirements setup i needed to setup the State in requirements and also set the Fixed: {} as required value
I'm Lena from the YouTrack Team.
Do I understand correctly that you managed to find the solution?
yes