Automatic and Manual Input of Date in JIRA Cloud

Carla Dumale November 8, 2018

I created new custom field wherein it can automatically gives the Pre UAT date based on the created date and SLA. But the condition is, once the initial Pre UAT date was missed or passed due and the issue is still not resolved, there'll be another option wherein Pre UAT can be manually written. How to insert code for manual input of date? And also, I want to consider the weekends and Holidays in getting the "Pre UAT" Date.

I am not a developer and unfamiliar with the language so I will really appreciate your help. Thanks!

Here is what I wrote:

date PreUAT;
string[] SLA = "customfield_10056";
//number SLA = Severity;
date startDate = created + "1d";
string startWorkingHour = "09:00";
string endWorkingHour = "18:00";
number[] weekendDays = {7,1};
date [] holidays = {"2018-12-25", "2019-01-01", "2019-02-05", "2019-02-06", "2019-04-19", "2019-05-01", "2019-05-19", "2019-06-05", "2019-08-09", "2019-08-11", "2019-10-27", "2019-12-25"};
number hours = getWorkingInterval(created, currentDate(), startWorkingHour, endWorkingHour, weekendDays, holidays);


if ("customfield_10056" == "1-Showstopper"){
PreUAT = "1d" + startDate;
if (PreUAT < currentDate()){
}
return PreUAT;
}

else if ("customfield_10056" == "2-Major"){
PreUAT = "4d" + startDate;
if (PreUAT < currentDate()){
}
return PreUAT;
}

else if ("customfield_10056" == "3-Medium"){
PreUAT = "7d" + startDate;
if (PreUAT < currentDate()){
return PreUAT;
}
}

//missing manual input & consider weekends holidays

1 answer

0 votes
Alexey Matveev
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.
November 8, 2018

Hello,

1, If you want a user to enter a date, then you should create a screen with a date custom field. Then you get the value of this field in your script.

2, You already provided holidays in your script. Why is it not enough?

Carla Dumale November 8, 2018

Hi Alexy,

1. I already added Date picker custom field. Is it possible to make it automatic based on the formula and can be manually set at the same time?

2. As much as possible, I don't want to make the holidays hard coded, so it can be easily modified in the future. Cause these dates are only applicable next year, and if they want to change it at least they won't need to touch the coding. 

Suggest an answer

Log in or Sign up to answer