ScriptRunner : There is only one task in In progress status for CurrentUser()

Viktoryia K_ April 19, 2024

Hello community!
I installed ScriptRunner on our JSM Cloud to somehow implement the process. We need that in a JWM project (managed by a company) on the board (status) In progress, the current user can only have one task. That is, it can be a condition or a validator in a workflow that prevents a task from being transferred from the To do status to the In progress status for someone if the performer already has a task in In progress.

I'm new to this and don't know how to write a working script. If you have a solution that is feasible without the ScriptRunner app, I would greatly appreciate it!

3 answers

1 accepted

1 vote
Answer accepted
Oliver Siebenmarck _Polymetis Apps_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 23, 2024

Hi @Viktoryia K_ ,

If I get you right, you want to avoid users having more than one In Progress task. If a task is already assigned to the user, you'll need to check if the user has another In Progress task before you allow the transition. The way to do that on Jira Cloud – as you already know – are conditions/validators based on Jira Expressions.

Jira Expressions are pretty amazing, but do have some limitations. One of those limitations is that you cannot load additional data via JQL in a condition– you have to make do with what you get in context

In theory, validators are a bit more flexible: One can actually build validators that run a Forge function to validate a transition after the fact. Again in theory, you could build a validator with Forge that performs the check you want. I am not sure if any apps actually offer something like this currently (April 2024), but I believe ScriptRunner does not currently have a validator like this. I do not work for Adaptavist though, so I might be wrong here.

Of course, you could always build a Forge app yourself that does exactly what you want. It's not complicated at all, especially since there's good documentation and templates available, but it's still coding, so you should be comfortable with JavaScript/TypeScript, if you want to go down that route. 

Lastly, there are a few other approaches you could use to achieve a similar result. Personally, I would simply use a filter and a dashboard widget to show me all issues currently in progress and sort them by user. That's not super sophisticated, but would allow me to find any double booked users quickly. 

Hope that helps,
 Oliver

 

Viktoryia K_ April 25, 2024

Hello @Oliver Siebenmarck _Polymetis Apps_ 

The point is not in tracking, but in the fact that 1 user = 1 task in the In progress status, and no more. The point is to prohibit moving from other statuses to the In progress status if there is this 1 task in the In progress status. I couldn't find a solution through validators, conditions and post-workflow functions, unfortunately.

The application support answer leans towards their database of scripts that are often used in Jira, but there is nothing there that or similar to what I need.
As far as I can conclude now, the only solution is, as you said, to make your own application, but so far it’s difficult for me...

1 vote
Kristian Walker _Adaptavist_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2024

Hi Viktoryia,

 

I can confirm that ScriptRunner for Jira Cloud Workflow validators use the Jira Expression framework provided by Atlassian.

Using this you would need to write an expression that first checked the status of the current issue was in progress and would then need to get all issues in the project and filter these to check if the status of the issue was in progress and if the asignee on the issue matched the current user and if the number of issues that matched was not greater than 1 issue.

We have some examples in the documentation page here which show how to use Jira expressions that you can use as a guide to help write the expression that you require.

Finally, if you need further assistance then I would advise raising a support ticket here and our support team can assist with writin this expression that you require.

I hope this information helps.

Regards,

Kristian

Viktoryia K_ April 21, 2024


Thanks for the answer. I understand what you are talking about and I tried to write expressions, but nothing works. I wrote to your support on Friday and hope for their help

0 votes
Viktoryia K_ April 19, 2024

@Trudy Claspill maybe you can help us?

Vikrant Yadav
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 19, 2024

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
PREMIUM
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events