Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal

Recognition

  • Give kudos
  • Received
  • Given

Leaderboard

  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

I have a groovy script where new updates of the methods is not corresponding

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));

1 answer

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));
}
////////////////////////////////////////////////////////////////////////////

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Jira

Jira Cloud Performance Improvements

Hello everyone, I am a product manager in the Jira Cloud team focused on making sure our customers have a delightful experience using our products. Towards that goal, one of the areas which is extr...

175 views 2 9
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you