Creating activities

Activities must be created from an existing account, job, or policy using one of the following endpoints:

  • POST account/v1/accounts/{accountId}/activities
  • POST job/v1/jobs/{jobId}/activities
  • POST policy/v1/policies/{policyId}/activities

Activity patterns

Activities are created from activity patterns. An activity pattern is a set of default values for fields in the activity (such as description, subject, and priority). Every activity pattern has a code, such as contact_insured or legal_review.

When creating an activity through Cloud API, the only required field is activityPattern, which must specify the activity pattern's code. Because the activity pattern typically contains all the necessary default values, the activity pattern is often the only field the caller application needs to specify.

You can retrieve a list of activity patterns using the following:

  • GET /account/v1/accounts/{accountId}/activity-patterns
  • GET /job/v1/jobs/{jobId}/activity-patterns
  • GET /policy/v1/policies/{policyId}/activity-patterns

You can optionally specify values for the following fields, each of which overrides the value coming from the activity pattern:

Field Datatype Description Default
description string The activity's description Typically comes from the activity pattern
dueDate datetime The date by which the activity is expected to be completed Typically calculated based on values in the activity pattern
escalationDate datetime The date on which the activity will be escalated if it has not yet been completed Typically calculated based on values in the activity pattern
externallyOwned Boolean Whether the activity is to be assigned to an external group or external user Typically comes from the activity pattern
importance Typekey (a value from the ImportanceLevel typelist) The activity's importance, as reflected on the user's calendar Typically comes from the activity pattern
mandatory Boolean Whether the activity must be completed (true) or can be skipped (false) Typically comes from the activity pattern
priority Typekey (a value from the Priority typelist) The activity's priority Typically comes from the activity pattern
recurring Boolean Whether the activity repeats. If true, completing the activity creates a new one. Typically comes from the activity pattern
subject String The activity's subject Typically comes from the activity pattern

Examples of creating activities

The following is an example of creating a contact_insured activity for account pc:10. The activity defaults to all values in the contact_insured activity pattern.

Command

POST /account/v1/accounts/pc:10/activities

Request

{
  "data": {
    "attributes": {
      "activityPattern": "contact_insured"
    }
  }
}

The following is an example of creating a legal_review activity for account pc:10. In this case, two activity pattern values are overridden: the activity is mandatory (it cannot be skipped) and the priority is urgent.

Command

POST /account/v1/accounts/pc:10/activities

Request

{
  "data": {
    "attributes": {
      "activityPattern": "legal_review",
      "mandatory": true,
      "priority": {
        "code": "urgent"
      }
    }
  }
}