Show/Hide Toolbars

In your API code, you may need to perform actions on records that meet specified criteria, particularly as part of a rule specification. For example, before integrating with a billing system, a rule may search the database for all task records added to a matter within a period of time.

Search in the API using ResourceService.search(), which provides similar functionality to search views in the TeamConnect user interface.

Because searching may drastically affect performance, verify that there is no other way to get the desired list of records. If you must conduct a search, especially against a large number of records, narrow your search criteria and consider providing a time-out.

Before using the search() methods, consider using available predefined methods to get related records. For example, the User interface has the getContact() method to obtain the contact of a user. The Project interface has methods for obtaining a list of child or involved records.

The following table provides examples of records that custom code is likely to includes as part of a search and whether or not an alternative exists.

To Search or Not to Search

If you are looking for

Use search?

Use this instead

Yes

No

All contacts.

x

 

 

Any documents (but not document folders).

x

 

 

Any history records.

x

 

 

Any of these system object records related records to a Project record:

Accounts

Appointments

Expenses

Tasks

x

 

 

Child or embedded records of a Project record.

 

x

Project.getEmbeddedProjects

ProjectService.getChildProjects

Child records of an Account record.

x

 

 

Current user.

 

x

UtilityService.getCurrentUser()

Involved record associated with an account.

x

 

 

Old object.

 

x

ResourceService.read()

Parent record of a related Account record.

 

x

Account.getParentAccount()

Parent record of a related Project record.

 

x

Project.getParentProject()

Project of a related system object record.

 

x

SystemObjectName.getProject()

For example, Task.getProject()

Project record of an Involved record.

 

x

Involved.getProject()

Record to which a History record is related.

 

x

History.getParentObject()

Sub-objects.

 

x

Use the appropriate methods defined in the owner interface. For details, see Sub-Objects.