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.
Input Type Description recordIdstring Required. The ID of the work order or work order line item to add the work plans to. workPlanTemplateIdListarray of strings Required. The IDs of the work plan templates used to instantiate the work plans.
Output Type Description recordIdstring The ID of the work order or work order line item. workPlanIdListarray of strings The list of work plan IDs.
Sample Input
The following code sample adds work plans:
1 {
2 " inputs " : [ {
3 " recordId " : "0 WOxx00000007j3 ",
4 " workPlanTemplateIdList " : [ "7 Iyxx0000004LSS ", "7 Iyxx0000004LTT " ]
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 " : "0 WOxx00000007j3 ",
7 " workPlanIdList " : [ "0 gqxx0000000Adh ", "0 gqxx0000000Adi " ]
8 }
9 } ]
Add Work Steps
URI: /services/data/vXX.X/actions/standard/addWorkSteps
This action creates work step records from the work plan library.
Input Type Description recordIdstring Required. The ID of the work plan to add the work steps to. workStepTemplateIdListarray of strings Required. The IDs of the work step templates used to instantiate the work steps.
Output Type Description recordIdstring The ID of the work order or work order line item. workStepIdListarray of strings The list of work step IDs.
Sample Input
The following code sample adds work steps:
1 {
2 " inputs " : [ {
3 " recordId " : "0 gqRM0000004DxoYAE ",
4 " workStepTemplateIdList " : [ "4 L0xx0000004FJoCAM ", "4 L0xx0000004FJoNAC " ]
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 " : "0 gqRM0000004DxoYAE ",
7 " workstepIdList " : [ "0 hFxx00000007uLEAQ ", "0 hFxx00000007uRAUW " ]
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.
Input Type Description recordIdstring Required. The ID of the work order or work order line item to generate work plans for.
Output Type Description recordIdstring The ID of the work order or work order line item. workPlanIdListarray of strings The list of work plan IDs.
Sample Input
The following code sample generates a work plan:
1 {
2 " inputs " : [ {
3 " recordId " : "0 WOxx00000007j3 "
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 " : "0 WOxx00000007j3 ",
7 " workPlanIdList " : [ "0 gqxx0000000Adh ", "0 gqxx0000000Adi " ]
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.
Input Type Description recordIdstring Required. The ID of the work order or work order line item.
Output Type Description recordIdstring The ID of the work order or work order line item. workPlanIdListarray 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 " : "0 WORM000000621X ",
7 " workPlanIdList " : [ "0 gqRM0000004CRS " ]
8 }
9 } ]