You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Hi,
I did updates in java library and now the script displays errors in the lines 50/53/54
# def results = searchService.search(query, user, PagerFilter.getUnlimitedFilter())
# for (def issue : results.getIssue()){
calculoHorasLinealesQ1(issueManager.getIssueObject(issue.key));
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.bc.issue.search.SearchService
import com.atlassian.jira.jql.parser.JqlQueryParser
import com.atlassian.jira.web.bean.PagerFilter
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
// FUNCTION: CÁLCULO DE LAS HORAS LINEALES /////////////////////////////////
def calculoHorasLinealesQ1(Issue issue){
def cfManager = ComponentAccessor.getCustomFieldManager();
def horas= cfManager.getCustomFieldObject(16135); //'Horas lineales 2020-Q1'
def estimacionesFieldIds=[
'Estimación Loyalty 2020-Q1':16125,
'Estimación MCR 2020-Q1':16126,
'Estimación Campañas 2020-Q1':17409,
'Estimación iBlue 2020-Q1':16133,
'Estimación Salesforce 2020-Q1':16129,
'Estimación Voz 2020-Q1':16132,
'Estimación APP 2020-Q1':16117,
'Estimación Assistant 2020-Q1':16118,
'Estimación Booking Engine 2020-Q1':16119,
'Estimación Channel Manager 2020-Q1':16121,
'Estimación Melia.com 2020-Q1':16127,
'Estimación Extranet & Switch 2020-Q1':16123,
'Estimación RMS 2020-Q1':16128,
'Estimación Sirius 2020-Q1':16131,
'Estimación Servicios y Pasarela & Message Broker 2020-Q1':16130,
'Estimación Customer Intelligence & ETL 2020-Q1':16122,
'Estimación Focus 2020-Q1':16124
];
if(horas != null && estimacionesFieldIds != null){
double hl = 0;
for (def id: estimacionesFieldIds.values()){
def estimacion = cfManager.getCustomFieldObject(id)?.getValue(issue);
if(estimacion != null) hl += (double) estimacion;
}
def changeHolder = new DefaultIssueChangeHolder()
log.warn(issue.key + "|" + hl);
horas.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(horas), hl),changeHolder); // Actualizar el campo de horas lineales con el valor de 'hl'
}
}
////////////////////////////////////////////////////////////////////////////
// JQL QUERY ///////////////////////////////////////////////////////////////
def jqlQueryParser = ComponentAccessor.getComponent(JqlQueryParser)
def SearchService = ComponentAccessor.getComponent(SearchService)
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
// edit this query to suit
def query = jqlQueryParser.parseQuery("issuetype = Épica AND category = 'BUSINESS DEVELOPMENT TECHNOLOGIES'")
def results = searchService.search(query, user, PagerFilter.getUnlimitedFilter())
/////////////////////////////////////////////////////////////////////////////
// ACCIONES SOBRE LAS ÉPICAS BDT ////////////////////////////////////////////
for (def issue : results.getIssue()){
calculoHorasLinealesQ1(issueManager.getIssueObject(issue.key));
}
////////////////////////////////////////////////////////////////////////////
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.