Forums

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

Scriptrunner range condition

Sandra Carrillo
Contributor
May 30, 2022

Hi,
We need to know how create in Scriptrunner this condition:
"End date" is in the range ("Baseline end date" field, "Baseline end date " field - 7 days)
Can you help us please?

Thanks a lot.

1 answer

0 votes
Andrea Pannitti
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.
May 30, 2022

Hi @Sandra Carrillo ,

you could use this code in a simple scripted condition:

 

import com.atlassian.jira.component.ComponentAccessor

def cfEndDate = ComponentAccessor.customFieldManager.getCustomFieldObjectsByName("End Date").first()
def cfBaseLineEndDate = ComponentAccessor.customFieldManager.getCustomFieldObjectsByName("Baseline end date").first()

def EndDate = issue.getCustomFieldValue(cfEndDate) as Date
def BaseLineEndDate = issue.getCustomFieldValue(cfBaseLineEndDate) as Date

return EndDate >= BaseLineEndDate.minus(7) && EndDate <= BaseLineEndDate

Suggest an answer

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

Atlassian Community Events