Update Work Order
Introduction
The Assetic REST API endpoint PUT /api/v2/workorder/{id} is used to update a work order. {id} is the unique GUID of the Work Order that is to be updated.
NOTE The PUT endpoint does not support partial updates, so the update payload must include all editable fields with either their current value or the new/modified value
The article Create Work Order provides detailed information about the various fields in the work order object. Use this is the reference when looking to change fields (other than free text or numeric fields) via the PUT endpoint.
Updating fields in work order
The following steps should be followed:
- Retrieve the work order using the Assetic REST endpoint GET /api/v2/workorder/{id} which ensures the required fields for the PUT payloads are in the response. Refer to article Get Work Order
- Modify the response object to set new values for the keys (fields) that require updating.
- Apply the update using the modified response object as the payload for the PUT.
NOTE It is not possible to modify a Work Order's existing Work Group using the PUT endpoint. If allowed, labour object links within the work order would be removed due to a change in work groups causing a potential loss of information.
Supporting Information Comments
An exception to this process is the "Supporting Information" object which is a list object. New comments may be added by appending to this list, but existing comments cannot be modified.
You can add another comment to the "Supporting Information" by including a new SupportingInformation object in the SupportingInformation key
"SupportingInformation": [{"Description": "Patch as required additional"}]
If there are no additional comments to add then the SupportingInformation object may be left as is from the GET response, or set to null.
Linked Work Requests
Work Requests that are approved may be linked to the work order using the GUID of the work request. Including the following sample in the payload will link 2 work requests to the work order.
"LinkedWorkRequests": [{"ID": "f5650456-3248-4d46-8920-a7b1281c8028"},
{"ID": "9564cdc8-067e-406d-bc14-556759e60f5c"}]
NOTE If the work request is already linked to another work order, the linkage to that work order will be removed and the work request will instead be linked to the work order being updated. This is because a work request can only be linked to one work order.
Workflow changes
It is possible to change the status of a work order provided the validation rules for moving from one status to the next are followed.
