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 

https://www.jetbrains.com/help/youtrack/devportal/using-workflow-api.html#access-properties-custom-fields-issue-links 

 

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.

0
3 comments

this is problem of requirements setup i needed to setup the State in requirements and also set the Fixed: {} as required value

0
Hello,

I'm Lena from the YouTrack Team.

Do I understand correctly that you managed to find the solution?
0

Please sign in to leave a comment.