The goal is to be able to check what is the duration of the workItems per state in a workflow. In order to have a guard per specific State that does not allow to move in other states if hours are not recorded. This is the goal but we are struggling with the basics.
Basic 1: is to identify the state of the issue which if we agree can be done by ctx.issue.State
Basic2 : compare it with some specific State that could be dynamically added to the workflow. When i try to take ctx.State.Open or ctx.State.Open.name and place it anywhere in if condition in workflow.message i get that Open is unidentified and technically ctx.State is unidentified. So i see in code to use this becomes function and pass inside ctx.State and then the state you want to check also i see to do
ctx.issue.State.name === ctx.State.Open.name
but none of them are working what do i miss?
Basic3 : can i see work items based on state? Cause when i saw workItems there is a field issue then getting last or first workItem, the issue field was again unidentified.
workItems.last().issue was unidentified.
Is this the place https://www.jetbrains.com/help/youtrack/devportal/rest-api-reference.html?