Show/Hide Toolbars

Resource services provide classes for creating, reading, updating, deleting, searching for, and manipulating model objects. Each service class corresponds to a TeamConnect entity or object type (for example, contacts, projects, accounts, invoices, etc.).

While each service class has it's own set of methods that are specific to that object, ResourceService provides a few common functions that all service classes extend, as shown in the following table.

ResourceService Method Actions

Action

Methods to Use

Creating a record

Use the create() method to create a record.

Note: When writing code to create a record for a rule, condition, or wizard, you do not need to use the create() method because the changes automatically commit to the database.

Use the batchCreate() method to create multiple records.

Updating a record

Use the update() method to update a record.

Note: When writing code to update a new record for a rule, condition, or wizard, you do not need to use the update() method because the changes automatically commit to the database.

Use the batchUpdate() method to update multiple records.

Reading a record

Use the read() method to read a record using it's primary key.

Use the readLastSaved() method  to read the last saved version of a record. You can use this version to determine if a record property has any updates.

Deleting a record

Note: When you want to delete a record that is a dependency for another record, consider the best way to delete that record.

Use the delete() methods to delete a record:

oOne delete() method deletes an object for which you have a reference.

oThe other delete() method deletes an object for which you have no reference and the primary key is known.

Use batchDelete() to delete multiple records. batchDelete() uses the delete() method multiple times.

Creating a copy of a record

Use the copyEntity() method to create a copy of a record.

Searching for a record

Use the search() methods to search for a record:

oOne search() method uses the search criteria to search.

oOne search() method uses the search criteria and parameters to search.

oOne search() method uses an existing search view to search.

All search() methods use the search model classes.

Determining if security settings changed

Use the isSecurityChange() method to determine if security settings for an entity changed.

Retrieves a record URL

Use the getRecordURL() method to return the URL to a record on your instance.

For examples of some of these functions, see the code examples for each service class:

AccountService

AppointmentService

ContactService

DocumentService

ExpenseService

GroupService

HistoryService

InvoiceService

ProjectService

InvolvedService

TaskService

UserService