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.

InputTypeDescription
recordIdstringRequired. The ID of the work order or work order line item to add the work plans to.
workPlanTemplateIdListarray of stringsRequired. The IDs of the work plan templates used to instantiate the work plans.
OutputTypeDescription
recordIdstringThe ID of the work order or work order line item.
workPlanIdListarray of stringsThe 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.

InputTypeDescription
recordIdstringRequired. The ID of the work plan to add the work steps to.
workStepTemplateIdListarray of stringsRequired. The IDs of the work step templates used to instantiate the work steps.
OutputTypeDescription
recordIdstringThe ID of the work order or work order line item.
workStepIdListarray of stringsThe 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.

InputTypeDescription
recordIdstringRequired. The ID of the work order or work order line item to generate work plans for.
OutputTypeDescription
recordIdstringThe ID of the work order or work order line item.
workPlanIdListarray of stringsThe 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.

InputTypeDescription
recordIdstringRequired. The ID of the work order or work order line item.
OutputTypeDescription
recordIdstringThe ID of the work order or work order line item.
workPlanIdListarray of stringsThe 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} ]