The following sample reads a task record and returns the specified property values.
protected TaskRepository taskRepository;
private List<String> getPropertiesToRead() {
List<String> props = new List<String>();
//the list of all available properties displays below but to increase efficiency in your searches, you can omit unnecessary properties from your application and those values will not be returned
props.add("shortDescription");
props.add("uniqueKey");
props.add("currentAssignee");
props.add("categories");
props.add("createdOn");
props.add("modifiedBy");
props.add("version");
props.add("modifiedOn");
props.add("contact");
props.add("project");
props.add("activityItem");
props.add("priority");
props.add("workStatus");
props.add("postingStatus");
props.add("dueDate");
props.add("startDate");
props.add("completedDate");
props.add("completedPercent");
props.add("actualHours");
props.add("estimatedHours");
props.add("rateAmount");
props.add("totalAmount");
props.add("note");
return props;
}
private Task readTask() throws Exception {
Task readTask = taskRepository.readTask(uniqueKey, getPropertiesToRead());
return readTask;
}