Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,558,997
Community Members
 
Community Events
184
Community Groups

Date validator (30 days) - JMWE

Example:

Today is 05/25/2023 and if I create a task on 06/26/2023 (30 days) it will show an error message,

and if I create a task between the interval on 05/25/2023-06/25/2023 there is no error and the task is being created.

 

What is the query to get that result??

and what type of validator can I use??

1 answer

1 accepted

0 votes
Answer accepted
David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 25, 2023

Hi @RIZKY JTUASIKAL ,

what do you mean by "I create a task on 06/26/2023"? Where is that date input? In a custom field?

Hi @David Fischer _Appfire_ ,

it doesn't use custom field/date input. 

is that possible?



or does it have to use date input?

 

 

please advice,

 

thank you David 

Example:


I created subtask A, and will record the creation date.

Created on 05/25/2023.

 

Then there is a rule if it is still within 30 days (bases on the date of subtask A creation),

I can still create another subtask,

(ex: subtask B)

 

 

but, if it exceeds 30 days, I can't create subtask B

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2023

So to summarize:

  1. you create a main issue
  2. you create a first sub-task on that issue
  3. when you attempt to create a second sub-task on that issue, you want to disable the creation if the first sub-task was created more than 30 days earlier
  4. when you attempt to create additional sub-tasks, you want to disable the creation if the oldest sub-task was created more than 30 days earlier

Is that correct?

Like RIZKY JTUASIKAL likes this

Yes, it's correct.

Everything you described above is correct, @David Fischer _Appfire_ :)

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 26, 2023

Hi @RIZKY JTUASIKAL ,

in that case, you can use a Build-your-own Validator with this Jira Expression:

!issue.parent || !issue.parent.subtasks.some(sub=>sub.created < new Date().minusDays(30))

Hi @David Fischer _Appfire_ ,

 

" when you attempt to create a second sub-task on that issue, you want to disable the creation if the first sub-task was created more than 30 days earlier "

what if these two subtasks are different issue types and workflows?

Ex:

subtask 1 is "Release Project"

subtask 2 is "Release PIR"

does it mean that I have to create a validator in the create transition (in Release PIR workflow)?

create.PNG
so that subtask 2 cannot be created if it exceeds 30 days





for addtional information,

I use the Release Project - Created Date field as the reference date.

release date created date.PNG

 

This field (Release Project - Created Date) is the date when subtask 1 was created. 

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 28, 2023
  1. Yes, you need to add the Validator on the Create transition of the sub-task workflow(s)
  2. With my script, you don't need to refer to the Prelease Project - Created Date since the script looks at all sub-tasks and their creation date
Like RIZKY JTUASIKAL likes this

Thank you @David Fischer _Appfire_ , for the answers

I really appreciate it

 

 

but one more question,

"With my script, you don't need to refer to the Prelease Project - Created Date since the script looks at all sub-tasks and their creation date"

what if only one of the subtasks?
for example, Release PIR subtask only

David Fischer _Appfire_
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 29, 2023

Then you can use your custom field instead:

!issue.parent || !issue.parent.customfield_12345 || issue.parent.customfield_12345 >= new Date().minusDays(30)

where customfield_12345 is the custom field ID of the Release Project - Created date custom field.  

Like RIZKY JTUASIKAL likes this

thank you David :)

you help me so much

Suggest an answer

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

Atlassian Community Events