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:

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 Type Description
recordId string Required. The ID of the work order or work order line item to add the work plans to.
workPlanTemplateIdList array of strings Required. The IDs of the work plan templates used to instantiate the work plans.
Table 2. Outputs
Output Type Description
recordId string The ID of the work order or work order line item.
workPlanIdList array of strings The list of work plan IDs.

Sample Input

The following code sample adds work plans:

1{
2    "inputs" : [ {
3        "recordId" : "0WOxx00000007j3",
4        "workPlanTemplateIdList" : ["7Iyxx0000004LSS", "7Iyxx0000004LTT"]
5    }]
6}

Sample Output

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

1[ {
2    "actionName" : "addWorkPlans",
3    "errors" : null,
4    "isSuccess" : true,
5    "outputValues" : {
6        "recordId" : "0WOxx00000007j3",
7        "workPlanIdList" : ["0gqxx0000000Adh", "0gqxx0000000Adi"]
8    }
9} ]

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 Type Description
recordId string Required. The ID of the work plan to add the work steps to.
workStepTemplateIdList array of strings Required. The IDs of the work step templates used to instantiate the work steps.
Table 4. Outputs
Output Type Description
recordId string The ID of the work order or work order line item.
workStepIdList array of strings The list of work step IDs.

Sample Input

The following code sample adds work steps:

1{
2    "inputs" : [ {
3        "recordId" : "0gqRM0000004DxoYAE",
4        "workStepTemplateIdList" : ["4L0xx0000004FJoCAM", "4L0xx0000004FJoNAC"]
5    }]
6}

Sample Output

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

1[ {
2    "actionName" : "addWorkSteps",
3    "errors" : null,
4    "isSuccess" : true,
5    "outputValues" : {
6       "recordId" : "0gqRM0000004DxoYAE",
7       "workstepIdList" : ["0hFxx00000007uLEAQ", "0hFxx00000007uRAUW"]
8    }
9} ]

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 Type Description
recordId string Required. The ID of the work order or work order line item to generate work plans for.
Table 6. Outputs
Output Type Description
recordId string The ID of the work order or work order line item.
workPlanIdList array of strings The list of work plan IDs.

Sample Input

The following code sample generates a work plan:

1{
2    "inputs" : [ {
3        "recordId" : "0WOxx00000007j3"
4    }]
5}

Sample Output

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

1[ {
2    "actionName" : "generateWorkPlans",
3    "errors" : null,
4    "isSuccess" : true,
5    "outputValues" : {
6        "recordId" : "0WOxx00000007j3",
7        "workPlanIdList" : ["0gqxx0000000Adh", "0gqxx0000000Adi"]
8    }
9} ]

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 Type Description
recordId string Required. The ID of the work order or work order line item.
Table 8. Outputs
Output Type Description
recordId string The ID of the work order or work order line item.
workPlanIdList array of strings The ID list for the work plans that were deleted.

Sample Input

The following code deletes a work plan:

1{
2    "inputs" : [ {
3        "recordId" : "OWOxxxxxxxxxxxx"
4    }]
5}

Sample Output

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

1[ {
2    "actionName" : "deleteWorkPlans", 
3    "errors" : null, 
4    "isSuccess" : true, 
5    "outputValues" : { 
6        "recordId" : "0WORM000000621X", 
7        "workPlanIdList" : [ "0gqRM0000004CRS" ]
8     } 
9} ]