User information
 Loading ...
Show article in Knowledge Base

 Adding and editing worklogs using the Web service API Export knowledge base Export     SubscribeSubscribe      Show article info

You can easily adding and editing issue worklogs using the Web service API.


The method that you should use to get, create and delete issue worklogs are:

  • getIssueWorkLog
  • storeIssueWorkLog
  • deleteIssueWorkLog


Other methods that be helpful are:

  • getIssueWorkLogsForPeriod
  • getAllIssueWorkLogs
  • getAllWorkLogCategories



Create a new worklog

To create a worklog you should use the method storeIssueWorkLog. That method takes an IssueWorkLog object as the only parameter. For a new worklog you have to set these attributes on the IssueWorkLog object:



int projectIssueId = 0; // Should be a valid ProjectIssue primaryKey
Date now = new GregorianCalendar().getTime();

IssueWorkLog issueWorkLog = new IssueWorkLog();
issueWorkLog.setTimeSpent(5); // 5 hours
issueWorkLog.setWorkDescription("Performed some work...");

// Created by

// Work performed by

// Store the new worklog
IssueWorkLog storedIssueWorkLog = visionProjectWebService.storeIssueWorkLog(issueWorkLog);




Edit a worklog

When editing a worklog you first have to fetch the IssueWorkLog object from the server, make some modifications on the client and the store it.


If you know the primaryKey of the IssueWorkLog object you can use the method: getIssueWorkLog to get the IssueWorkLog object from the server, like this:



// Get a IssueWorklog object from the server
IssueWorkLog workLog = visionProjectWebService.getIssueWorkLog(worklogId);

// Set the time spent to 8 hours 

// Store the modification
workLog = visionProjectWebService.storeIssueWorkLog(workLog);



If you know the primaryKey of a ProjectIssue you can use the method: getAllIssueWorkLogs, like this:

IssueWorkLog [] workLogs = visionProjectWebService.getAllIssueWorkLogs(projectIssueId);


And then you can "take" the IssueWorkLog object that you would like to modify and store it.



Worklog categories

You can also set a "Worklog category" on worklogs. To get the available you should use the method: getAllWorkLogCategories and then you can use the id from one of them to set the worklog category on a worklog, like this:



WorkLogCategory[] workLogCategories = visionProjectWebService.getAllWorkLogCategories();
if (workLogCategories.length > 0) {
    WorkLogCategory workLogCategory = workLogCategories[0];

    // Set the category on a worklog       

User comments
 Loading ...