What I need:
A due date to be auto-filled based on what custom dropdown field already says, but to also account for our weekend.
Dropdown selection is:
Request Complexity: (custom field: 14220)
- Simple (3 days)
- Average (7 days)
- Complex (14 days)
The days in italics (above) are how much time to add to the current date for the due date.
Due Date (custom field: 14233)
- Needs to account for the weekend (ours is Friday-Sunday).
- Example: if a user starts this process on a Thursday, and the request is a "Simple" complexity, it would actually be due on Tuesday since we "skip" Friday-Sunday.
What I have:
This is my current code, but it doesn't account for the weekend, but it also doesn't work as-is. I would greatly appreciate any help or code you can provide. Thank you!
import com.atlassian.jira.component.ComponentAccessor
import java.text.SimpleDateFormat
def customFieldManager = ComponentAccessor.customFieldManager
def duedate = customFieldManager.getCustomFieldObjects(14233)
def complexityField = customFieldManager.getCustomFieldObjects(14220)
def complexityFieldValue = issue.getCustomFieldValue(complexityField).value.toString()
def dateFormat = new SimpleDateFormat("d/MMM/yy")
def duedateValue = dateFormat.parse(issue.getCustomFieldValue(duedate).toString())
if(complexityFieldValue == "Simple"){
duedateValue + 3}
else if(complexityFieldValue == "Average"){
duedateValue + 7}
else if(complexityFieldValue == "Complex"){
duedateValue + 14}