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

How to Create Worklog automatically via plugin?

Simon Collins September 13, 2011

Hi

I've written a listener plugin that amongst other things, automatically updates the worklog based on the user pressing start progress & stop progress.

The worklog updates at the bottom of the screen, but the logged work shown on the right of the screen (plus the remaining estimate) does not update.

it is calling createAndAutoAdjustRemainingEstimate

Is there anything I've missed? It works fine except it doesnt appear to update the estimate

ComponentManager cm = ComponentManager.getInstance(); 

IssueIndexManager indexManager = cm.getIndexManager(); 

 

JiraAuthenticationContext jac = cm.getJiraAuthenticationContext();

User user = jac.getUser();

//JiraServiceContext jsc = new JiraWebActionSupport().getJiraServiceContext();

JiraServiceContext jsc = new JiraServiceContextImpl(user);

WorklogService wls = (WorklogService) ComponentManager.getComponentInstanceOfType(WorklogService.class);

JiraServiceContext context = new JiraServiceContextImpl( user );

 

       String timeSpent = dur + "m";

       startFieldText.getCustomFieldType().updateValue(startFieldText,issueEvent.getIssue(),timeSpent);

       WorklogNewEstimateInputParameters params = createParams( issue, timeSpent, stDate );

 

       WorklogResult result = wls.validateCreate( context, params );

       wls.createAndAutoAdjustRemainingEstimate( context, result, true );

 

   try { 

indexManager.reIndex(issueGV2); 

} catch (IndexException e) { 

throw new WorkflowException(e); 

} 

 

private WorklogNewEstimateInputParameters createParams( MutableIssue issue, String timeSpent, Date StartDate ) {

       return WorklogInputParametersImpl

               .issue( issue )

               .startDate( StartDate )

               .timeSpent( timeSpent )

               .comment( "Autologged " + timeSpent + "." )

               .buildNewEstimate();

   }

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

0 votes
Jasen Sparacino August 21, 2013

Is this working for you now? I am in need of the same thing.

0 votes
Simon Collins September 13, 2011

screengrab

TAGS
AUG Leaders

Atlassian Community Events