Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Jira Expression Validator - Time Spent

Jannis December 2, 2024

Hi everyone,

I am currently having issues when trying to create an "either, or" validator within a Jira workflow.

The setting is as follows: When working on a task, users can report their time spent on sub tasks, which will then be added up within the parent task. This is not a must, as sub-tasks are optional. When doing the final transition, I would like to ensure that times have been reported. Due to the nature of things this can either have happend via the accumulated sub-task times or via a time spent log during the transition itself.

We have tried solving this by using Jira Expression Validators, enabled through the app "Workflow Building Blocks for Jira" (https://marketplace.atlassian.com/apps/1233642?tab=overview&hosting=cloud). The expression we have tried is:

(issue.worklogs != null ) || (issue.timeSpent != null)

Using the normal field value validator is also not working, as checking for both "Time spent" and "∑ Time spent" creates an AND condition.

Maybe someone encountered this issue before and knows a workaround or fix for my Jira expression.

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Maciej Dudziak _Forgappify_
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.
December 2, 2024

Hi @Jannis

Thank you for your interest in the app and your question. Please correct me if I’ve understood your requirement correctly: if you want to simply ensure that time is logged either on the issue itself or on any of its subtasks, the following might suffice for you:

issue.timeSpent != null || issue.subtasks.some(subtask => subtask.timeSpent != null)
Jannis December 2, 2024

@Maciej Dudziak _Forgappify_  Thanks for the support!

The suggestion seems to be working as hoped. 

Maciej Dudziak _Forgappify_
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.
December 2, 2024

That’s great! I’m happy to help. :)

0 votes
Maciej Dudziak _Forgappify_
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.
February 7, 2025

Hi @Jannis

Hope you're doing well! I just wanted to share that our quest to simplify the use of Jira Expressions has led to what we call the Ultimate Validator, now in Beta. With it, you can build complex conditions easily using a simple UI.

Below, you'll find how it works:

timespent_subtasks_780 (1).gif

I hope you’ll like it!

Cheers

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events