Work Plan and Work Step Actions

Manage work plans and work steps using actions.

For more information about Field Service, see the Field Service Developer Guide.

These actions are available in API version 52.0 and later. They require Field Service to be enabled.

Add Work Plans Limits
You can generate work plans linked to work orders via the addWorkPlans flow, but, by default, users can only generate 100 work plans per work order.

Supported REST HTTP Methods

URIs
Add work plans: /services/data/vXX.X/actions/standard/addWorkPlans
Add work steps: /services/data/vXX.X/actions/standard/addWorkSteps
Generate work plans: /services/data/vXX.X/actions/standard/generateWorkPlans
Delete work plans: /services/data/vXX.X/actions/standard/deleteWorkPlans
Formats
JSON, XML
HTTP Methods
GET, HEAD, POST
Authentication
Authorization: Bearer token

Add Work Plans

URI: /services/data/vXX.X/actions/standard/addWorkPlans

This action creates work plan records from the work plan library.

Table 1. Inputs
Input Details
recordId
Type
string
Description
Required. The ID of the work order or work order line item to add the work plans to.
workPlanTemplateIdList
Type
array of strings
Description
Required. The IDs of the work plan templates used to instantiate the work plans.
Table 2. Outputs
Output Details
recordId
Type
string
Description
The ID of the work order or work order line item.
workPlanIdList
Type
array of strings
Description
The list of work plan IDs.
Sample Input

The following code sample adds work plans:

{
    "inputs" : [ {
        "recordId" : "0WOxx00000007j3",
        "workPlanTemplateIdList" : ["7Iyxx0000004LSS", "7Iyxx0000004LTT"]
    }]
}
Sample Output

The following code sample illustrates a response after a successful request.

[ {
    "actionName" : "addWorkPlans",
    "errors" : null,
    "isSuccess" : true,
    "outputValues" : {
        "recordId" : "0WOxx00000007j3",
        "workPlanIdList" : ["0gqxx0000000Adh", "0gqxx0000000Adi"]
    }
} ]

Add Work Steps

URI: /services/data/vXX.X/actions/standard/addWorkSteps

This action creates work step records from the work plan library.

Table 3. Inputs
Input Details
recordId
Type
string
Description
Required. The ID of the work plan to add the work steps to.
workStepTemplateIdList
Type
array of strings
Description
Required. The IDs of the work step templates used to instantiate the work steps.
Table 4. Outputs
Output Details
recordId
Type
string
Description
The ID of the work order or work order line item.
workStepIdList
Type
array of strings
Description
The list of work step IDs.
Sample Input

The following code sample adds work steps:

{
    "inputs" : [ {
        "recordId" : "0gqRM0000004DxoYAE",
        "workStepTemplateIdList" : ["4L0xx0000004FJoCAM", "4L0xx0000004FJoNAC"]
    }]
}
Sample Output

The following code sample illustrates a response after a successful request.

[ {
    "actionName" : "addWorkSteps",
    "errors" : null,
    "isSuccess" : true,
    "outputValues" : {
       "recordId" : "0gqRM0000004DxoYAE",
       "workstepIdList" : ["0hFxx00000007uLEAQ", "0hFxx00000007uRAUW"]
    }
} ]

Generate Work Plans

URI: /services/data/vXX.X/actions/standard/generateWorkPlans

This action generates work plans based off rules defined in the work plan library.

Table 5. Inputs
Input Details
recordId
Type
string
Description
Required. The ID of the work order or work order line item to generate work plans for.
Table 6. Outputs
Output Details
recordId
Type
string
Description
The ID of the work order or work order line item.
workPlanIdList
Type
array of strings
Description
The list of work plan IDs.
Sample Input

The following code sample generates a work plan:

{
    "inputs" : [ {
        "recordId" : "0WOxx00000007j3"
    }]
}
Sample Output

The following code sample illustrates a response after a successful request.

[ {
    "actionName" : "generateWorkPlans",
    "errors" : null,
    "isSuccess" : true,
    "outputValues" : {
        "recordId" : "0WOxx00000007j3",
        "workPlanIdList" : ["0gqxx0000000Adh", "0gqxx0000000Adi"]
    }
} ]

Delete Work Plans

URI: /services/data/vXX.X/actions/standard/deleteWorkPlans

This action deletes all the work plans (and its child work steps) associated with a WorkOrder or WorkOrderLineItem.

Table 7. Inputs
Input Details
recordId
Type
string
Description
Required. The ID of the work order or work order line item.
Table 8. Outputs
Output Details
recordId
Type
string
Description
The ID of the work order or work order line item.
workPlanIdList
Type
array of strings
Description
The ID list for the work plans that were deleted.
Sample Input

The following code deletes a work plan:

{
    "inputs" : [ {
        "recordId" : "OWOxxxxxxxxxxxx"
    }]
}
Sample Output

The following code sample illustrates a response after a successful request.

[ {
    "actionName" : "deleteWorkPlans", 
    "errors" : null, 
    "isSuccess" : true, 
    "outputValues" : { 
        "recordId" : "0WORM000000621X", 
        "workPlanIdList" : [ "0gqRM0000004CRS" ]
     } 
} ]