A special rank field is available to allow you to sort issues using a configurable ranking formula. The rank menu allows you to define the formula used in this calculation. The rank field is just like any other field. It can be added as a column in the main menu and made visible to any of the issue detail screens.
The formula must return a numerical rank which is commonly used for escalation purposes. You can also set the rank to specific values that can be searched for by filters. This is very useful for triggering events, such as overdue items.
When using dates in the formulas, you must remember that dates are calculated down to the millisecond. When you enter a due date, you typically only enter the year/month/day. The system however, stores it down to the millisecond (defaulting to 0's if it has nothing else). Therefore you can not simply compare dates to the current Date() method, as the millisecond at any instance is not going to be 0's.
mPriority
(100-mPriority*10)+getElapsedTime()
(mRequestedDueDate!=null) ? ( (mRequestedDueDate.getTime() <= new java.util.Date().getTime()) ? 1 : 0 ) : 0
(mCurrentStatus=="Open") ? 1 : (mCurrentStatus=="Closed" && (mDateLastModified.getTime() > new java.util.Date().getTime()-X)) ? 1 : 0
Note: substitute "X" for "new Long(XL).longValue()" for large numbers (ie: greater than 10 days)
@@rint(@@max(1.0, (mPriority - (mPriority==2?(getSecondsSinceLastModified()/14400.0):0.0) - (mPriority==3?(getSecondsSinceLastModified()/86400.0):0.0)))*1000)/1000
(mUserFields!=null && mUserFields.get(new Integer(21))!=null) ? mUserFields.get(new Integer("21")) : 0
This formula will set (to 1) any requested due date that matches today:
(mRequestedDueDate!=null) ? ( (mRequestedDueDate.getDay() == new java.util.Date().getDay() && mRequestedDueDate.getMonth() == new java.util.Date().getMonth() && mRequestedDueDate.getYear() == new java.util.Date().getYear() ) ? 1 : 0 ) : 0
http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/apa.html
http://www.ognl.org/2.6.9/Documentation/html/LanguageGuide/index.html
public long mId;
public int mRecordVersion;
public Date mDateEntered;
public String mSubject;
public String mCurrentStatus;
public String mCurrentAssignedTo;
public String mLastModifiedBy;
public Date mDateLastModified;
public String mEnteredBy;
public int mPriority;
public String mProject;
public String mArea;
public String mVersion;
public String mEnvironment;
// Vector of BugEntries...
public Vector mBugHistory;
// New fields for Project Management...
public long mParent;
public Date mRequestedDueDate;
public Date mActualCompletionDate;
public double mEstimatedHours;
public double mActualHours;
public double mPercentComplete;
public int mArchived;
public int mElapsedTime;
public String mNotifyList;
public int mRejectedCount;
public String mUniqueProjectId; // The id with project appended to it...
public Date mClosedDate = null; // Date the issue first went to a closed state
// Hashtable of user defined values...
public Hashtable mUserFields;
// Hashtable of current user defined values (specified in bugentry)
public Hashtable mCurrentUserFields;
Functions:
int countRejects();
Object getUserField(int i);
Object getUserField(UserField uf);
int getElapsedTime();
long getElapsedTimeSeconds();
long getSecondsSinceLastModified();