...
Here are some fields that you can use in this use case:
Field | Type | Details |
---|
Name | Jira property | Project name |
Support pack status | Status | The current status of the service |
Principal agent | User picker | The agent responsible for the service |
Expired | Script | Calculates service status according to date Replace EXPIRATION_DATE_FIELD_ID. It is the Identifier of the date type field that stores the expiry date. Code Block |
---|
import com.atlassian.jira.component.ComponentAccessor
import com.deiser.jira.profields.api.field.date.DateField
import com.deiser.jira.profields.api.field.FieldService
import com.deiser.jira.profields.api.value.ValueService
def EXPIRATION_DATE_FIELD_ID = 33
Calendar getCalendarWithoutTime(Date date) {
Calendar calendar = new GregorianCalendar()
calendar.setTime(date)
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), calendar.get(Calendar.DAY_OF_MONTH), 0, 0, 0)
calendar.set(Calendar.MILLISECOND, 0)
return calendar;
}
def fieldService = ComponentAccessor.getOSGiComponentInstanceOfType(FieldService.class)
def valueService = ComponentAccessor.getOSGiComponentInstanceOfType(ValueService.class)
def expirationDateField = fieldService.get(EXPIRATION_DATE_FIELD_ID)
def expirationDate = valueService.getValue(project, (DateField)expirationDateField)
if (expirationDate == null) {
return false
}
Calendar expired = getCalendarWithoutTime(expirationDate)
Calendar actual = getCalendarWithoutTime(new Date())
return actual.compareTo(expired)>0 |
|
Country | Select list | Country where the service is performed |
Comments | Text field multiple line | Last comments |
Support Pack Size | Original estimate | Hours contracted for the service |
Total time spent | Cumulative | Total hours logged in the service |
Total Remaining Estimate | Script | Calculates Support Pack Size - Total time spent
Replace PACK_SIZE Replace TIME_SPENT Code Block |
---|
import com.atlassian.jira.component.ComponentAccessor
import com.deiser.jira.profields.api.field.duration.DurationField
import com.deiser.jira.profields.api.field.cumulative.CumulativeField
import com.deiser.jira.profields.api.value.ValueService
def PACK_SIZE = 22
def TIME_SPENT = 82
def valueService = ComponentAccessor.getOSGiComponentInstanceOfType(ValueService.class)
def packSizeValue = valueService.getValue(project, (DurationField)fieldService.get(PACK_SIZE))
def timeSpentValue = valueService.getValue(project, (CumulativeField)fieldService.get(TIME_SPENT))
String format (seconds){
return "${((seconds/3600)*10)/10}h"
}
if (packSizeValue == null) {
return format(0)
}
if (timeSpentValue == null) {
return format(packSizeValue)
}
return format(packSizeValue - timeSpentValue) |
|
Last activity | Script | Calculates the last activity of the issues Code Block |
---|
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.jql.builder.JqlQueryBuilder
import com.atlassian.jira.web.bean.PagerFilter
import java.text.SimpleDateFormat
def searchService = ComponentAccessor.getOSGiComponentInstanceOfType(SearchService.class)
def user = ComponentAccessor.jiraAuthenticationContext.getLoggedInUser()
def lastUpdatedDate = new Date(Long.MIN_VALUE)
def builder = JqlQueryBuilder.newBuilder()
builder.where().project(project.id)
def query = builder.buildQuery()
def results = searchService.search(user, query, PagerFilter.getUnlimitedFilter())
if (results.getTotal() == 0) {
return ""
}
else {
def i = 0
for (Issue issue : results.getResults())
{
def lastUpdated = issue.getUpdated()
if (i == 0 || lastUpdated > lastUpdatedDate)
lastUpdatedDate = lastUpdated
i++
}
return new SimpleDateFormat("dd/MMM/yy").format(lastUpdatedDate)
} |
|
Support Pack Activation Date | Date | Date on which service is to begin |
Support Pack Expiration Date | Date | Date on which service expires |
Proposal Data | Text field | Link to service documentation |
Customer Main Contact | User picker | Primary customer contact (non-technical) |
Customer Technical Contact | User picker | Customer's main technical contact |
Supported Products | Select list | List of products for which the customer can request support |
Applicable SLA | Select list | Type of service level agreement |
...