MaintenancePlan

Represents a preventive maintenance schedule for one or more assets in field service.

Supported Calls

create(), delete(), describeLayout(), describeSObjects(), getDeleted(), getUpdated(), query(), retrieve(), search(), undelete(), update(), upsert()

Special Access Rules

Field Service Lightning must be enabled.

Fields

Field Name Details
AccountId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The associated account, which typically represents the customer receiving the maintenance service.
ContactId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The associated contact.
Description
Type
textarea
Properties
Create, Nillable, Update
Description
A brief description of the plan.
DoesAutoGenerateWorkOrders
Type
boolean
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
Turns on auto-generation of work order batches for a maintenance plan and prohibits the manual generation of work orders via the Generate Work Orders action. If this option is selected, a new batch of work orders is generated for the maintenance plan on the NextSuggestedMaintenanceDate listed on each maintenance asset, or on the maintenance plan if no assets are included. If a GenerationHorizon is specified, the date of generation is that many days earlier.
DoesGenerateUponCompletion
Type
boolean
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
If both this option and DoesAutoGenerateWorkOrders are set to true, a new batch of work orders isn’t generated until the last work order generated from the maintenance plan is completed. A work order is considered completed when its status falls into one of the following status categories: Cannot Complete, Canceled, Completed, or Closed.

If a maintenance plan covers multiple assets, work orders are generated per asset. If a maintenance asset’s final work order is completed late, its work order generation is delayed, which may cause a staggered generation schedule between maintenance assets.

EndDate
Type
date
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The last day the maintenance plan is valid.
Frequency
Type
int
Properties
Create, Filter, Group, Sort, Update
Description
(Required) Amount of time between work orders. The unit is specified in the FrequencyType field.
FrequencyType
Type
picklist
Properties
Create, Defaulted on create, Filter, Group, Restricted picklist, Sort, Update
Description
(Required) The unit of frequency:
  • Days
  • Weeks
  • Months
  • Years

For example, to perform monthly maintenance visits you need a work order for each visit, so enter 1 as the Frequency and select Months.

GenerationHorizon
Type
int
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Moves up the timing of batch generation if DoesAutoGenerateWorkOrders is set to true. A generation horizon of 5 means the new batch of work orders is generated 5 days before the maintenance asset’s (or maintenance plan’s, if there are no assets) NextSuggestedMaintenanceDate. The generation horizon must be a whole number.
GenerationTimeframe
Type
int
Properties
Create, Filter, Group, Sort, Update
Description

(Required) How far in advance work orders are generated in each batch. The unit is specified in the GenerationTimeframeType field.

GenerationTimeframeType
Type
picklist
Properties
Create, Defaulted on create, Filter, Group, Restricted picklist, Sort, Update
Description
(Required) The generation timeframe unit:
  • Days
  • Weeks
  • Months
  • Years

For example, if you need work orders for six months, enter 6 and select Months.

LastReferencedDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
The timestamp for when the current user last viewed a record related to this record.
LastViewedDate
Type
dateTime
Properties
Filter, Nillable, Sort
Description
The timestamp for when the current user last viewed this record. If this value is null, this record might only have been referenced (LastReferencedDate) and not viewed.
LocationId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Where the service takes place.
MaintenancePlanNumber
Type
string
Properties
Autonumber, Defaulted on create, Filter, Sort
Description
(Read Only) An auto-assigned number that identifies the maintenance plan.
MaintenancePlanTitle
Type
string
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
A name for the maintenance plan.
MaintenanceWindowEndDays
Type
int
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Days after the suggested service date on the work order that its service appointment can be scheduled.
MaintenanceWindowStartDays
Type
int
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
Days before the suggested service date on the work order that its service appointment can be scheduled.

The maintenance window start and end fields affect the Earliest Start Permitted and Due Date fields on the maintenance plan’s work orders’ service appointments. For example, if you enter 3 for both the maintenance window start and end, the Earliest Start Permitted and the Due Date will be 3 days before and 3 days after, respectively, the Suggested Maintenance Date on each work order. If the maintenance window fields are left blank, the service appointment date fields list their work order’s suggested maintenance date.

NextSuggestedMaintenanceDate
Type
date
Properties
Create, Filter, Group, Sort, Update
Description
The suggested date of service for the first work order (not the date the work order is created). This corresponds to the work order’s SuggestedMaintenanceDate. You can use this field to enforce a delay before the first maintenance visit (for example, if monthly maintenance should begin one year after the purchase date). Its label in the user interface is Date of the first work order in the next batch.
For example, if you want the first maintenance visit to take place on May 1, enter May 1. When you generate work orders, the earliest work order will list a suggested maintenance date of May 1, and the dates on the later work orders will be based on the GenerationTimeframe and Frequency.
Important

Important

Maintenance assets also list a NextSuggestedMaintenanceDate, which is initially inherited from the maintenance plan. If the plan has maintenance assets, this date auto-updates on the maintenance assets after each batch is generated, but doesn’t update on the maintenance plan itself because batch timing is calculated at the maintenance asset level. If the plan doesn’t have maintenance assets, this date auto-updates on the maintenance plan after each batch is generated.

OwnerId
Type
reference
Properties
Create, Defaulted on create, Filter, Group, Sort, Update
Description
The owner of the maintenance plan.
ServiceContractId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The service contract associated with the maintenance plan. The service contract can’t be updated if any child maintenance asset is associated with a contract line item from the service contract.
StartDate
Type
date
Properties
Create, Filter, Group, Sort, Update
Description
The first day the maintenance plan is valid.
WorkOrderGenerationStatus
Type
picklist
Properties
Defaulted on create, Filter, Group, Nillable, Restricted picklist, Sort
Description
(Read Only) Indicates whether the work order generation is in progress or complete. You can generate only one batch at a time.
WorkTypeId
Type
reference
Properties
Create, Filter, Group, Nillable, Sort, Update
Description
The associated work type. Work orders generated from the maintenance plan inherit its work type’s duration, required skills and products, and linked articles. Maintenance assets covered by the plan use the same work type, though you can update them to use a different one.