# ServiceWorks

> Run your field service business in ServiceWorks: find and add customers, book and schedule jobs, assign technicians, update job status, text customers, email invoices, and list invoices and payments.

App · 23 actions. Web page: https://docs.lodol.com/docs/integrations/serviceworks

## Actions

### Add customer note

Add a line to the note on a customer's record, or replace the note.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.
- Note (`note`, text, required): The text to add.
- How (`mode`, text): Add to the end of the note, or replace it. One of: `append` (Add to the end of the note), `replace` (Replace the note). Default: `append`.

**Outputs**

- `customer` (object): The customer, as ServiceWorks returns it
- `customer_id` (number): The customer's id

**Example output**

```json
{
  "customer": {
    "AccountNumber": "TEST1",
    "Addresses": [
      {
        "AddressId": 15695363,
        "AddressLine1": "1001 Craig Road",
        "AddressLine2": "",
        "City": "ST. LOUIS",
        "CountryCode": "",
        "Email": "jerry.holland@none.com",
        "FirstName": "Starter",
        "IsActive": true,
        "IsParentAddress": false,
        "LastName": "Package",
        "Lat": "38.6725623",
        "Long": "-90.4370574",
        "Note": "",
        "NotifyEmail": false,
        "NotifyPrimaryPhone": false,
        "NotifySecondaryPhone": false,
        "PrimaryPhone": "636 220 4363",
        "SecondaryPhone": "",
        "State": "MO",
        "Type": 2,
        "Zip": "63146"
      }
    ],
    "BillToId": 0,
    "CompanyName": "Jerry Holland Test",
    "Content": [],
    "CustomFields": [
      {
        "FieldId": 1,
        "FieldName": "Industry",
        "FieldType": "Text",
        "FieldTypeId": 1,
        "FieldValue": "Service",
        "Fields": [],
        "MandetoryforInstantBooking": false,
        "MappingId": 142472,
        "SelectedValue": 0
      }
    ],
    "CustomerId": 14563590,
    "CustomerType": 0,
    "Email": "",
    "Finance": {
      "CreditLimit": 0,
      "CurrentDue": 0,
      "IsTaxExempt": false,
      "TaxCode": null
    },
    "FirstName": "Jerry",
    "IsActive": true,
    "ItemPrice": null,
    "LastName": "Holland",
    "LeadStatus": "Test 1",
    "LeadStatusId": 3521,
    "Note": "",
    "ParentId": 0,
    "ParentName": null,
    "PickupPointId": null,
    "PrimaryPhone": "1112223333",
    "PropertyManagementCustomerAccNumber": "",
    "PropertyManagementCustomerId": 0,
    "RedFlag": {
      "CreatedBy": null,
      "CreatedByUserId": 0,
      "IsRedFlagActivated": false,
      "Reason": null,
      "TimeStamp": "0001-01-01T00:00:00"
    },
    "SalesMan": "",
    "SecondaryPhone": null,
    "SendEmial": true,
    "SendTextToPrimaryPhone": true,
    "SendTextToSecondaryPhone": false,
    "Status": 1,
    "Technician": ""
  },
  "customer_id": 14563590
}
```

### Add job note

Add a note to a job, for the office and its technicians.

**Inputs**

- Job ID (`job_id`, text, required): The job's id, from 'Create job', 'Find jobs' or an earlier step.
- Note (`note`, text, required): The note's text.
- Visit ID (`visit_id`, text): Which visit to the job, for a job with more than one. Leave empty for its latest visit.

**Outputs**

- `job_id` (number): The job's id
- `message` (text): ServiceWorks' own confirmation message
- `visit_id` (number): The visit's id

**Example output**

```json
{
  "job_id": 716519,
  "message": "Success",
  "visit_id": 723845
}
```

### Create customer

Add a customer with their phone, email and service address, such as from a website booking form.

**Inputs**

- First name (`first_name`, text, required): The customer's first name.
- Last name (`last_name`, text): The customer's last name.
- Company (`company_name`, text): The customer's company, for a business customer.
- Phone (`phone`, text, required): The customer's main phone number, such as 636 220 4363.
- Second phone (`second_phone`, text): Another phone number for the customer.
- Email (`email`, text): The customer's email address.
- Street address (`address_line1`, text, required): Where the service takes place, such as 9 Pebble Creek Road.
- City (`city`, text, required): The service address's city.
- State (`state`, text, required): The service address's state, such as MO.
- ZIP code (`zip_code`, text): The service address's ZIP or postal code.
- Email updates (`email_updates`, true/false): Email the customer about their jobs. On unless turned off. Default: `true`.
- Text updates (`text_updates`, true/false): Text the customer about their jobs. Off unless turned on. Default: `false`.

**Outputs**

- `customer` (object): The customer, as ServiceWorks returns it
- `customer_id` (number): The customer's id

**Example output**

```json
{
  "customer": {
    "AccountNumber": "TEST1",
    "Addresses": [
      {
        "AddressId": 15695363,
        "AddressLine1": "1001 Craig Road",
        "AddressLine2": "",
        "City": "ST. LOUIS",
        "CountryCode": "",
        "Email": "jerry.holland@none.com",
        "FirstName": "Starter",
        "IsActive": true,
        "IsParentAddress": false,
        "LastName": "Package",
        "Lat": "38.6725623",
        "Long": "-90.4370574",
        "Note": "",
        "NotifyEmail": false,
        "NotifyPrimaryPhone": false,
        "NotifySecondaryPhone": false,
        "PrimaryPhone": "636 220 4363",
        "SecondaryPhone": "",
        "State": "MO",
        "Type": 2,
        "Zip": "63146"
      }
    ],
    "BillToId": 0,
    "CompanyName": "Jerry Holland Test",
    "Content": [],
    "CustomFields": [
      {
        "FieldId": 1,
        "FieldName": "Industry",
        "FieldType": "Text",
        "FieldTypeId": 1,
        "FieldValue": "Service",
        "Fields": [],
        "MandetoryforInstantBooking": false,
        "MappingId": 142472,
        "SelectedValue": 0
      }
    ],
    "CustomerId": 14563590,
    "CustomerType": 0,
    "Email": "",
    "Finance": {
      "CreditLimit": 0,
      "CurrentDue": 0,
      "IsTaxExempt": false,
      "TaxCode": null
    },
    "FirstName": "Jerry",
    "IsActive": true,
    "ItemPrice": null,
    "LastName": "Holland",
    "LeadStatus": "Test 1",
    "LeadStatusId": 3521,
    "Note": "",
    "ParentId": 0,
    "ParentName": null,
    "PickupPointId": null,
    "PrimaryPhone": "1112223333",
    "PropertyManagementCustomerAccNumber": "",
    "PropertyManagementCustomerId": 0,
    "RedFlag": {
      "CreatedBy": null,
      "CreatedByUserId": 0,
      "IsRedFlagActivated": false,
      "Reason": null,
      "TimeStamp": "0001-01-01T00:00:00"
    },
    "SalesMan": "",
    "SecondaryPhone": null,
    "SendEmial": true,
    "SendTextToPrimaryPhone": true,
    "SendTextToSecondaryPhone": false,
    "Status": 1,
    "Technician": ""
  },
  "customer_id": 14563590
}
```

### Create job

Book a new job (work order) for a customer on a day, with its technicians if you like.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.
- Problem (`description`, text, required): What the customer needs, such as 'Dryer not heating'.
- Date (`visit_date`, date, required): The day of the visit.
- Time (`start_time`, time): The time the visit starts, in your business's own time.
- Length in minutes (`duration_minutes`, number): How long the visit takes. Defaults to 60. From 5 to 1440.
- Arrival window (`time_window_id`, text): One of your arrival windows (such as 8 to 12). Leave empty to book for the day.
- Job type (`job_type_id`, text): The kind of job, from your ServiceWorks job types.
- Technicians (`technician_ids`, list): The technicians to assign. The first one picked leads the visit.
- Service address ID (`address_id`, text): Which of the customer's addresses (AddressId) the visit is at. Leave empty for ServiceWorks' default.
- Job note (`job_note`, text): A note for the office and technicians.

**Outputs**

- `job` (object): The new job

**Example output**

```json
{
  "job": {
    "customer_id": 14563590,
    "details": {
      "CustomerId": 14563590,
      "TicketId": 716519,
      "TicketNumber": "58037",
      "TicketStatus": "Scheduled",
      "TicketStatusId": 2,
      "TripAssignmentId": 723845
    },
    "job_id": 716519,
    "job_number": "58037",
    "status": "Scheduled",
    "status_id": 2,
    "visit_id": 723845
  }
}
```

### Email job invoice

Email a job's invoice (or estimate) from ServiceWorks, with a message of your own.

**Inputs**

- Job ID (`job_id`, text, required): The job's id, from 'Create job', 'Find jobs' or an earlier step.
- To (`to`, text, required): Email addresses to send to, separated by commas.
- Subject (`subject`, text, required): The email's subject.
- Message (`message`, text): The email's text.
- Cc (`cc`, text): Email addresses to copy in, separated by commas.
- Bcc (`bcc`, text): Email addresses to copy in privately, separated by commas.
- Attach invoice (`attach_invoice`, true/false): Attach the job's invoice. On unless turned off. Default: `true`.
- Attach estimate (`attach_estimate`, true/false): Attach the job's estimate. Default: `false`.
- Visit ID (`visit_id`, text): Which visit to the job, for a job with more than one. Leave empty for its latest visit.

**Outputs**

- `job_id` (number): The job's id
- `message` (text): ServiceWorks' own confirmation message
- `to` (text): Who it was sent to
- `visit_id` (number): The visit's id

**Example output**

```json
{
  "job_id": 716519,
  "message": "Success",
  "to": "james@example.com",
  "visit_id": 723845
}
```

### Find customers

Find customers by name, phone, email, account number or address. Give at least one.

**Inputs**

- Name (`name`, text): All or part of the customer's name.
- Phone (`phone`, text): The customer's phone number.
- Email (`email`, text): The customer's email address.
- Account number (`account_number`, text): The customer's account number.
- Address (`address`, text): All or part of the customer's address.
- Red-flagged only (`flagged_only`, true/false): Only customers who are red-flagged. Default: `false`.

**Outputs**

- `count` (number): How many were returned
- `customers` (list): The matching customers

**Example output**

```json
{
  "count": 1,
  "customers": [
    {
      "AccountNumber": "TEST1",
      "Addresses": [
        {
          "AddressId": 15695363,
          "AddressLine1": "1001 Craig Road",
          "AddressLine2": "",
          "City": "ST. LOUIS",
          "CountryCode": "",
          "Email": "jerry.holland@none.com",
          "FirstName": "Starter",
          "IsActive": true,
          "IsParentAddress": false,
          "LastName": "Package",
          "Lat": "38.6725623",
          "Long": "-90.4370574",
          "Note": "",
          "NotifyEmail": false,
          "NotifyPrimaryPhone": false,
          "NotifySecondaryPhone": false,
          "PrimaryPhone": "636 220 4363",
          "SecondaryPhone": "",
          "State": "MO",
          "Type": 2,
          "Zip": "63146"
        }
      ],
      "BillToId": 0,
      "CompanyName": "Jerry Holland Test",
      "Content": [],
      "CustomFields": [
        {
          "FieldId": 1,
          "FieldName": "Industry",
          "FieldType": "Text",
          "FieldTypeId": 1,
          "FieldValue": "Service",
          "Fields": [],
          "MandetoryforInstantBooking": false,
          "MappingId": 142472,
          "SelectedValue": 0
        }
      ],
      "CustomerId": 14563590,
      "CustomerType": 0,
      "Email": "",
      "Finance": {
        "CreditLimit": 0,
        "CurrentDue": 0,
        "IsTaxExempt": false,
        "TaxCode": null
      },
      "FirstName": "Jerry",
      "IsActive": true,
      "ItemPrice": null,
      "LastName": "Holland",
      "LeadStatus": "Test 1",
      "LeadStatusId": 3521,
      "Note": "",
      "ParentId": 0,
      "ParentName": null,
      "PickupPointId": null,
      "PrimaryPhone": "1112223333",
      "PropertyManagementCustomerAccNumber": "",
      "PropertyManagementCustomerId": 0,
      "RedFlag": {
        "CreatedBy": null,
        "CreatedByUserId": 0,
        "IsRedFlagActivated": false,
        "Reason": null,
        "TimeStamp": "0001-01-01T00:00:00"
      },
      "SalesMan": "",
      "SecondaryPhone": null,
      "SendEmial": true,
      "SendTextToPrimaryPhone": true,
      "SendTextToSecondaryPhone": false,
      "Status": 1,
      "Technician": ""
    }
  ]
}
```

### Find jobs

Find jobs booked in a date range (today unless given), or every job for a customer or job number.

**Inputs**

- From (`from_date`, date): The first day to include. Defaults to the 'To' day, or today.
- To (`to_date`, date): The last day to include. Defaults to today.
- Customer ID (`customer_id`, text): Only this customer's jobs.
- Customer name (`customer_name`, text): Only jobs for customers with this name.
- Job number (`job_number`, text): Only the job with this number.
- Unassigned only (`unassigned_only`, true/false): Only jobs with no technician yet. Default: `false`.

**Outputs**

- `count` (number): How many were returned
- `jobs` (list): The jobs, one row per visit

**Example output**

```json
{
  "count": 1,
  "jobs": [
    {
      "customer_id": 14563590,
      "details": {
        "CustomerId": 14563590,
        "TicketId": 716519,
        "TicketNumber": "58037",
        "TicketStatus": "Scheduled",
        "TicketStatusId": 2,
        "TripAssignmentId": 723845
      },
      "job_id": 716519,
      "job_number": "58037",
      "status": "Scheduled",
      "status_id": 2,
      "visit_id": 723845
    }
  ]
}
```

### Find parts

Find parts in your item catalog by part number or description.

**Inputs**

- Search (`search`, text, required): All or part of a part number or description.

**Outputs**

- `count` (number): How many were returned
- `parts` (list): The matching parts, as ServiceWorks lists them

**Example output**

```json
{
  "count": 1,
  "parts": [
    {
      "PartDescription": "DRIER",
      "PartNumber": "WPW10143759"
    }
  ]
}
```

### Get customer

Get one customer with their addresses, balances due, red flag and custom fields.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.

**Outputs**

- `customer` (object): The customer, as ServiceWorks returns it
- `customer_id` (number): The customer's id

**Example output**

```json
{
  "customer": {
    "AccountNumber": "TEST1",
    "Addresses": [
      {
        "AddressId": 15695363,
        "AddressLine1": "1001 Craig Road",
        "AddressLine2": "",
        "City": "ST. LOUIS",
        "CountryCode": "",
        "Email": "jerry.holland@none.com",
        "FirstName": "Starter",
        "IsActive": true,
        "IsParentAddress": false,
        "LastName": "Package",
        "Lat": "38.6725623",
        "Long": "-90.4370574",
        "Note": "",
        "NotifyEmail": false,
        "NotifyPrimaryPhone": false,
        "NotifySecondaryPhone": false,
        "PrimaryPhone": "636 220 4363",
        "SecondaryPhone": "",
        "State": "MO",
        "Type": 2,
        "Zip": "63146"
      }
    ],
    "BillToId": 0,
    "CompanyName": "Jerry Holland Test",
    "Content": [],
    "CustomFields": [
      {
        "FieldId": 1,
        "FieldName": "Industry",
        "FieldType": "Text",
        "FieldTypeId": 1,
        "FieldValue": "Service",
        "Fields": [],
        "MandetoryforInstantBooking": false,
        "MappingId": 142472,
        "SelectedValue": 0
      }
    ],
    "CustomerId": 14563590,
    "CustomerType": 0,
    "Email": "",
    "Finance": {
      "CreditLimit": 0,
      "CurrentDue": 0,
      "IsTaxExempt": false,
      "TaxCode": null
    },
    "FirstName": "Jerry",
    "IsActive": true,
    "ItemPrice": null,
    "LastName": "Holland",
    "LeadStatus": "Test 1",
    "LeadStatusId": 3521,
    "Note": "",
    "ParentId": 0,
    "ParentName": null,
    "PickupPointId": null,
    "PrimaryPhone": "1112223333",
    "PropertyManagementCustomerAccNumber": "",
    "PropertyManagementCustomerId": 0,
    "RedFlag": {
      "CreatedBy": null,
      "CreatedByUserId": 0,
      "IsRedFlagActivated": false,
      "Reason": null,
      "TimeStamp": "0001-01-01T00:00:00"
    },
    "SalesMan": "",
    "SecondaryPhone": null,
    "SendEmial": true,
    "SendTextToPrimaryPhone": true,
    "SendTextToSecondaryPhone": false,
    "Status": 1,
    "Technician": ""
  },
  "customer_id": 14563590
}
```

### Get dashboard figures

Get the figures on ServiceWorks' dashboard for a date range (today unless given), for a daily report.

**Inputs**

- From (`from_date`, date): The first day to include. Defaults to the 'To' day, or today.
- To (`to_date`, date): The last day to include. Defaults to today.

**Outputs**

- `dashboard` (object): The figures, as ServiceWorks names them
- `from_date` (text): The first day, YYYY-MM-DD
- `to_date` (text): The last day, YYYY-MM-DD

**Example output**

```json
{
  "dashboard": {
    "TotalJobs": 12
  },
  "from_date": "2026-10-21",
  "to_date": "2026-10-21"
}
```

### Get job

Get one job by its id or job number, with each visit to it. Give one of the two.

**Inputs**

- Job ID (`job_id`, text): The job's id, from 'Create job' or 'Find jobs'.
- Job number (`job_number`, text): The job number shown in ServiceWorks.

**Outputs**

- `count` (number): How many visits
- `job` (object): The job's latest visit
- `visits` (list): Every visit to the job

**Example output**

```json
{
  "count": 1,
  "job": {
    "customer_id": 14563590,
    "details": {
      "CustomerId": 14563590,
      "TicketId": 716519,
      "TicketNumber": "58037",
      "TicketStatus": "Scheduled",
      "TicketStatusId": 2,
      "TripAssignmentId": 723845
    },
    "job_id": 716519,
    "job_number": "58037",
    "status": "Scheduled",
    "status_id": 2,
    "visit_id": 723845
  },
  "visits": [
    {
      "customer_id": 14563590,
      "details": {
        "CustomerId": 14563590,
        "TicketId": 716519,
        "TicketNumber": "58037",
        "TicketStatus": "Scheduled",
        "TicketStatusId": 2,
        "TripAssignmentId": 723845
      },
      "job_id": 716519,
      "job_number": "58037",
      "status": "Scheduled",
      "status_id": 2,
      "visit_id": 723845
    }
  ]
}
```

### Get service history

List the service a customer has had, up to a day.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.
- Up to (`up_to`, date): The last day to include. Defaults to today.

**Outputs**

- `count` (number): How many were returned
- `customer_id` (number): The customer's id
- `history` (list): The customer's past service, as ServiceWorks lists it

**Example output**

```json
{
  "count": 1,
  "customer_id": 14563590,
  "history": [
    {
      "JobDescription": "Dryer not heating",
      "TicketNumber": "58037"
    }
  ]
}
```

### Get text messages

Get the text conversation with a customer.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.

**Outputs**

- `count` (number): How many were returned
- `customer_id` (number): The customer's id
- `messages` (list): The messages, as ServiceWorks lists them

**Example output**

```json
{
  "count": 1,
  "customer_id": 14563590,
  "messages": [
    {
      "MessageText": "See you at 9",
      "ToPhone": "6362228839"
    }
  ]
}
```

### List invoices

List unpaid, paid or canceled invoices from a date range (the last 30 days unless given).

**Inputs**

- Which invoices (`status`, text): Unpaid, paid or canceled invoices. One of: `due` (Unpaid), `paid`, `canceled`. Default: `due`.
- From (`from_date`, date): The first day to include. Defaults to 30 days ago.
- To (`to_date`, date): The last day to include. Defaults to today.
- Customer name (`customer_name`, text): Only this customer's invoices.
- Account number (`account_number`, text): Only invoices for this account number.
- Invoice number (`invoice_number`, text): Only the invoice with this number.
- Hide zero invoices (`hide_zero`, true/false): Leave out invoices for nothing. Default: `false`.

**Outputs**

- `count` (number): How many were returned
- `invoices` (list): The invoices, as ServiceWorks lists them
- `status` (text): Which invoices: due, paid or canceled

**Example output**

```json
{
  "count": 1,
  "invoices": [
    {
      "InvoiceNo": "58037",
      "Name": "Jerry Holland"
    }
  ],
  "status": "due"
}
```

### List payments

List the payments you have received, a page at a time.

**Inputs**

- Page (`page`, number): Which page, starting at 1. From 1 to 10000.
- Page size (`page_size`, number): How many on a page, 1 to 100. Defaults to 25. From 1 to 100.

**Outputs**

- `count` (number): How many were returned
- `page` (number): The page returned
- `payments` (list): The payments, as ServiceWorks lists them

**Example output**

```json
{
  "count": 1,
  "page": 1,
  "payments": [
    {
      "Amount": 110.0,
      "PaymentId": 34081
    }
  ]
}
```

### List schedule

List the jobs on the calendar for up to 31 days (today unless given), for one technician, job type or status if you like.

**Inputs**

- From (`from_date`, date): The first day to include. Defaults to the 'To' day, or today.
- To (`to_date`, date): The last day to include. Defaults to today.
- Technician (`technician_id`, text): Only this technician's jobs.
- Job type (`job_type_id`, text): Only jobs of this type.
- Status (`status_id`, text): Only jobs with this status.

**Outputs**

- `count` (number): How many were returned
- `jobs` (list): The jobs, one row per visit

**Example output**

```json
{
  "count": 1,
  "jobs": [
    {
      "customer_id": 14563590,
      "details": {
        "CustomerId": 14563590,
        "TicketId": 716519,
        "TicketNumber": "58037",
        "TicketStatus": "Scheduled",
        "TicketStatusId": 2,
        "TripAssignmentId": 723845
      },
      "job_id": 716519,
      "job_number": "58037",
      "status": "Scheduled",
      "status_id": 2,
      "visit_id": 723845
    }
  ]
}
```

### List technicians

List your technicians, or those whose name has some text.

**Inputs**

- Name (`name`, text): Only technicians whose name has this text.

**Outputs**

- `count` (number): How many were returned
- `technicians` (list): The technicians

**Example output**

```json
{
  "count": 1,
  "technicians": [
    {
      "details": {
        "EmployeeId": 1559,
        "EmployeeName": "Robin Wonder"
      },
      "name": "Robin Wonder",
      "technician_id": 1559
    }
  ]
}
```

### Schedule job

Book a job's visit for a day and time, and assign its technicians.

**Inputs**

- Job ID (`job_id`, text, required): The job's id, from 'Create job', 'Find jobs' or an earlier step.
- Date (`visit_date`, date, required): The day of the visit.
- Time (`start_time`, time): The time the visit starts, in your business's own time.
- Length in minutes (`duration_minutes`, number): How long the visit takes. Defaults to its current length. From 5 to 1440.
- Arrival window (`time_window_id`, text): One of your arrival windows (such as 8 to 12). Leave empty to book for the day.
- Technicians (`technician_ids`, list): The technicians to assign. The first one picked leads the visit.
- Visit ID (`visit_id`, text): Which visit to the job, for a job with more than one. Leave empty for its latest visit.

**Outputs**

- `job_id` (number): The job's id
- `message` (text): ServiceWorks' own confirmation message
- `scheduled_for` (text): The appointment as sent, MM/DD/YYYY hh:mm AM
- `technician_ids` (list): The technicians assigned
- `visit_id` (number): The visit's id

**Example output**

```json
{
  "job_id": 716519,
  "message": "Success",
  "scheduled_for": "11/24/2026 08:00 AM",
  "technician_ids": [
    1559
  ],
  "visit_id": 723845
}
```

### Send text to customer

Text a customer from your ServiceWorks number, at their main phone unless you give another.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.
- Message (`message`, text, required): The text to send.
- Phone (`to_phone`, text): The number to text. Leave empty for their main phone.

**Outputs**

- `customer_id` (number): The customer's id
- `message` (text): ServiceWorks' own confirmation message
- `to_phone` (text): The number texted

**Example output**

```json
{
  "customer_id": 14563590,
  "message": "Success",
  "to_phone": "6362228839"
}
```

### Set work performed

Write what was done on a job's visit, the explanation of service shown on its invoice. It replaces any already written.

**Inputs**

- Job ID (`job_id`, text, required): The job's id, from 'Create job', 'Find jobs' or an earlier step.
- Work performed (`work_performed`, text, required): What was done, such as 'Replaced heating element'.
- Visit ID (`visit_id`, text): Which visit to the job, for a job with more than one. Leave empty for its latest visit.

**Outputs**

- `job_id` (number): The job's id
- `message` (text): ServiceWorks' own confirmation message
- `visit_id` (number): The visit's id

**Example output**

```json
{
  "job_id": 716519,
  "message": "Success",
  "visit_id": 723845
}
```

### Update customer

Change a customer's name, company, account number, phones, email or update preferences. Only the details given change.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.
- First name (`first_name`, text): A new first name. Leave empty to keep it.
- Last name (`last_name`, text): A new last name. Leave empty to keep it.
- Company (`company_name`, text): A new company name. Leave empty to keep it.
- Account number (`account_number`, text): A new account number. Leave empty to keep it.
- Phone (`phone`, text): A new main phone number. Leave empty to keep it.
- Second phone (`second_phone`, text): A new second phone number. Leave empty to keep it.
- Email (`email`, text): A new email address. Leave empty to keep it.
- Email updates (`email_updates`, text): Whether ServiceWorks emails the customer about their jobs. One of: `on`, `off`.
- Text updates (`text_updates`, text): Whether ServiceWorks texts the customer about their jobs. One of: `on`, `off`.

**Outputs**

- `customer` (object): The customer, as ServiceWorks returns it
- `customer_id` (number): The customer's id

**Example output**

```json
{
  "customer": {
    "AccountNumber": "TEST1",
    "Addresses": [
      {
        "AddressId": 15695363,
        "AddressLine1": "1001 Craig Road",
        "AddressLine2": "",
        "City": "ST. LOUIS",
        "CountryCode": "",
        "Email": "jerry.holland@none.com",
        "FirstName": "Starter",
        "IsActive": true,
        "IsParentAddress": false,
        "LastName": "Package",
        "Lat": "38.6725623",
        "Long": "-90.4370574",
        "Note": "",
        "NotifyEmail": false,
        "NotifyPrimaryPhone": false,
        "NotifySecondaryPhone": false,
        "PrimaryPhone": "636 220 4363",
        "SecondaryPhone": "",
        "State": "MO",
        "Type": 2,
        "Zip": "63146"
      }
    ],
    "BillToId": 0,
    "CompanyName": "Jerry Holland Test",
    "Content": [],
    "CustomFields": [
      {
        "FieldId": 1,
        "FieldName": "Industry",
        "FieldType": "Text",
        "FieldTypeId": 1,
        "FieldValue": "Service",
        "Fields": [],
        "MandetoryforInstantBooking": false,
        "MappingId": 142472,
        "SelectedValue": 0
      }
    ],
    "CustomerId": 14563590,
    "CustomerType": 0,
    "Email": "",
    "Finance": {
      "CreditLimit": 0,
      "CurrentDue": 0,
      "IsTaxExempt": false,
      "TaxCode": null
    },
    "FirstName": "Jerry",
    "IsActive": true,
    "ItemPrice": null,
    "LastName": "Holland",
    "LeadStatus": "Test 1",
    "LeadStatusId": 3521,
    "Note": "",
    "ParentId": 0,
    "ParentName": null,
    "PickupPointId": null,
    "PrimaryPhone": "1112223333",
    "PropertyManagementCustomerAccNumber": "",
    "PropertyManagementCustomerId": 0,
    "RedFlag": {
      "CreatedBy": null,
      "CreatedByUserId": 0,
      "IsRedFlagActivated": false,
      "Reason": null,
      "TimeStamp": "0001-01-01T00:00:00"
    },
    "SalesMan": "",
    "SecondaryPhone": null,
    "SendEmial": true,
    "SendTextToPrimaryPhone": true,
    "SendTextToSecondaryPhone": false,
    "Status": 1,
    "Technician": ""
  },
  "customer_id": 14563590
}
```

### Update customer address

Change one of a customer's addresses. Only the parts given change, and their other addresses stay as they are.

**Inputs**

- Customer ID (`customer_id`, text, required): The customer's id, from 'Find customers' or an earlier step.
- Address ID (`address_id`, text): Which address, from the customer's Addresses (AddressId). Leave empty for their first address.
- Street address (`address_line1`, text): A new street address. Leave empty to keep it.
- Apartment or suite (`address_line2`, text): A new apartment, suite or unit. Leave empty to keep it.
- City (`city`, text): A new city. Leave empty to keep it.
- State (`state`, text): A new state. Leave empty to keep it.
- ZIP code (`zip_code`, text): A new ZIP or postal code. Leave empty to keep it.

**Outputs**

- `customer` (object): The customer, as ServiceWorks returns it
- `customer_id` (number): The customer's id

**Example output**

```json
{
  "customer": {
    "AccountNumber": "TEST1",
    "Addresses": [
      {
        "AddressId": 15695363,
        "AddressLine1": "1001 Craig Road",
        "AddressLine2": "",
        "City": "ST. LOUIS",
        "CountryCode": "",
        "Email": "jerry.holland@none.com",
        "FirstName": "Starter",
        "IsActive": true,
        "IsParentAddress": false,
        "LastName": "Package",
        "Lat": "38.6725623",
        "Long": "-90.4370574",
        "Note": "",
        "NotifyEmail": false,
        "NotifyPrimaryPhone": false,
        "NotifySecondaryPhone": false,
        "PrimaryPhone": "636 220 4363",
        "SecondaryPhone": "",
        "State": "MO",
        "Type": 2,
        "Zip": "63146"
      }
    ],
    "BillToId": 0,
    "CompanyName": "Jerry Holland Test",
    "Content": [],
    "CustomFields": [
      {
        "FieldId": 1,
        "FieldName": "Industry",
        "FieldType": "Text",
        "FieldTypeId": 1,
        "FieldValue": "Service",
        "Fields": [],
        "MandetoryforInstantBooking": false,
        "MappingId": 142472,
        "SelectedValue": 0
      }
    ],
    "CustomerId": 14563590,
    "CustomerType": 0,
    "Email": "",
    "Finance": {
      "CreditLimit": 0,
      "CurrentDue": 0,
      "IsTaxExempt": false,
      "TaxCode": null
    },
    "FirstName": "Jerry",
    "IsActive": true,
    "ItemPrice": null,
    "LastName": "Holland",
    "LeadStatus": "Test 1",
    "LeadStatusId": 3521,
    "Note": "",
    "ParentId": 0,
    "ParentName": null,
    "PickupPointId": null,
    "PrimaryPhone": "1112223333",
    "PropertyManagementCustomerAccNumber": "",
    "PropertyManagementCustomerId": 0,
    "RedFlag": {
      "CreatedBy": null,
      "CreatedByUserId": 0,
      "IsRedFlagActivated": false,
      "Reason": null,
      "TimeStamp": "0001-01-01T00:00:00"
    },
    "SalesMan": "",
    "SecondaryPhone": null,
    "SendEmial": true,
    "SendTextToPrimaryPhone": true,
    "SendTextToSecondaryPhone": false,
    "Status": 1,
    "Technician": ""
  },
  "customer_id": 14563590
}
```

### Update job status

Set a job's status, such as completed or canceled.

**Inputs**

- Job ID (`job_id`, text, required): The job's id, from 'Create job', 'Find jobs' or an earlier step.
- Status (`status_id`, text, required): The status to set, from your ServiceWorks statuses.
- Visit ID (`visit_id`, text): Which visit to the job, for a job with more than one. Leave empty for its latest visit.

**Outputs**

- `job_id` (number): The job's id
- `message` (text): ServiceWorks' own confirmation message
- `status_id` (number): The status set
- `visit_id` (number): The visit's id

**Example output**

```json
{
  "job_id": 716519,
  "message": "Success",
  "status_id": 2,
  "visit_id": 723845
}
```
