Hello,
I have two questions about the script I am trying to use.
Purpose: I would like to have issuetype = vulnerability tickets to have due dates based on the priority of a ticket when the ticket is created.
If the ticket is blocker , due date +7 days from the creation date
if the ticket is critical, due date +30 days from the creation date
if the ticket is major, due date +90 days from the creation date
1- how can I correct the error message below?
2-how can i add the issuetype of vulnerability to this script since script listener does not have a drop down box for it?
Thanks!
here is the script i used;
import java.sql.Timestamp
import com.atlassian.jira.issue.MutableIssue
// initializing the priority
def CRITICAL = 7;
def MAJOR = 30;
def MINOR = 90;
// calender which returns the date according to the priority defined
private GregorianCalendar getDate(double roll)
{
Calendar cal = Calendar.getInstance();
cal.setFirstDayOfWeek(Calendar.MONDAY);
cal.set(Calendar.HOUR_OF_DAY,0);
cal.set(Calendar.MINUTE,0);
cal.set(Calendar.SECOND,0);
cal.set(Calendar.MILLISECOND,0);
int numNonBusinessDays = 0;
for (int x=0;x<roll;x++)
{
if(cal.get(Calendar.DAY_OF_WEEK) == 1 ||
cal.get(Calendar.DAY_OF_WEEK) == 7) {
numNonBusinessDays++;
}
cal.add(Calendar.DATE, 1);
}
if(numNonBusinessDays > 0) {
cal.add(Calendar.DATE, numNonBusinessDays);
}
return cal;
}
Here is the latest error message after I made the changes you have requested above;
"private GregorianCalendar getDate(double roll){
}"
Well a method of the type "GregorianCalander" can only return a "GregorianCalender" value. The value you are trying to return is only "Calendar" - wont work.
If you are lucky changing:
"private GregorianCalendar getDate(double roll){"
to
"private Calendar getDate(double roll){""
will work but cant garuantee for that.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No error messages however script does not do anything. I created several tickets with Critical, Major and Minor priorities and due date is still empty.
Anyways, thanks a lot for your help.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There are two errors in two lines
for (int x=0;x<roll;x++)
if(numNonBusinessDays > 0)
Replace with
for (int x=0;x<roll;x++)
if(numNonBusinessDays > 0)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Markus ,
which one ;
if(numNonBusinessDays > 0) OR
if(numNonBusinessDays gt > 0)
Either way I have another error message, see below;
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.