Show/Hide Toolbars

You can use the following searching examples written in Java in your custom code. In these examples, the values in the current object are used unless otherwise stated.

You can find the following search samples in this section:

Searching for Child Accounts with Certain Posting Criteria

Getting a List of Tasks Completed within a Certain Time Period

Searching for Child Accounts with Certain Posting Criteria

The following code searches for all accounts with the same parent account and a specific project set as their posting criteria.

Search Requirements

Find all child accounts of the Matter XYZ Budget account that have a specific litigation record with the unique ID 7/15/2005-6548 set as their posting criteria.

Search Criteria

AND statement with the following qualifiers:

Parent account Matter XYZ Budget.

Litigation project with the unique ID 7/15/2005-6548 set as posting criterion.

Sample Values

System Field Attributes:

NAME (of the parent account)

NUMBER_STRING (ID of the project)

Categories:

None

Custom Field Attributes:

None

Searching for Child Accounts with Certain Posting Criteria

// An example of building more complicated field paths

AccountService accountService = platform.getAccountService();

 

// Search by the name of the parent account

FieldPath parentAccountName = new FieldPath(Account.PARENT_ACCOUNT).add(Account.NAME);

StringCriterion parentAccountNameCriterion = new StringCriterion(parentAccountName).equalTo("Matter XYZ Budget");

 

// Search by the number string of the project

FieldPath projectNumberString = new FieldPath(AccountPostingCriteria.PROJECT).add(Project.NUMBER_STRING);

StringCriterion projectNumberStringCriterion = new StringCriterion(projectNumberString).equalTo("7/15/2005-6548");

 

// Join the criteria together

SearchCriteria criteria = new SearchCriteria(parentAccountNameCriterion, projectNumberStringCriterion);

         

List<account> accounts = accountService.search(criteria);

Getting a List of Tasks Completed within a Certain Time Period

The following code gets a list of all tasks completed within the specified time period.

Search Requirements

Find all tasks John Smith completed within the month of June 2005.

Search Criteria

AND statement with the following qualifiers:

User object of the task assignee.

Tasks that are marked as completed.

The start date of the specified period, 06/01/2005.

The end date of the specified period, 06/30/2005.

Sample Values

System Field Attributes:

CURRENT_ASSIGNEE

COMPLETED_DATE

Categories:

None

Custom Field Attributes:

None

Searching for All Tasks Completed within a Certain Period

TaskService taskService = platform.getTaskService();

 

// Find tasks only for the given user

UserCriterion userCriterion = new UserCriterion(Task.CURRENT_ASSIGNEE).equalTo(assignee);

 

// Find tasks completed after the given start date and before the given end date

DateCriterion dateCriterion = new DateCriterion(Task.COMPLETED_DATE).between(6/01/2005, 6/30/2005);

 

// Join together the two criteria, using 'and' logic by default

SearchCriteria searchCriteria = new SearchCriteria(userCriterion, dateCriterion);

 

// Execute search and return results

List<Task> tasks = taskService.search(searchCriteria);