OS1 Services
Order Service

Work Order Attributes and Lifecycle

6min
work order attributes attributes of a work order can be divided into one of the following categories core these are the attributes mandated by the platform for work order entities some of these attributes are required system these are system defined attributes custom these attributes are defined by the tenant to enhance their usability tenants can define custom validations and also specify whether they are to be indexed or non indexed category attribute name data type expected description core tenant id string the id of the tenant to whose realm the work order belongs system work order id uuid system generated unique id core order id uuid the order to which this work order belongs core work order type varchar enum \ move containers \ physical service \ digital service core description varchar short textual description of the work order core pickupdetails varchar in case a work order has containers involved, this field stores the pickup details such as contact location pickupslot servicetime core returndetails (optional) varchar in case a work order has to be returned at a specific location, return details may include contact location returnslot servicetime core deliverydetails (optional) varchar delivery details may include promiseddeliverydate deliveryslot deliveryservicetime core containers (optional) list list of container ids (container details collected in platform order creation payload ) core pickup quality checks (optional) object core collect amount on pickup (optional) boolean core amount to collect on delivery (optional) amount object amount object including currency code custom custom attributes 1 to n (indexed) key value core attributes for a work order with indexing the tenant will be able to configure validations, if required, for these attributes custom custom attributes 1 to n (non indexed) key value custom attributes for a work order without indexing the tenant will be able to configure validations, if required, for these attributes system current state varchar system current sub state varchar system schema version (optional) integer the version of the work order schema configuration (for custom attributes) that was used to create the order system createdat (optional) timestamp system updatedat (optional) timestamp system created by (optional) varchar system updated by (optional) varchar creating work order custom attribute to create a work order custom attribute, call the post /work order/config/attributes endpoint and pass the following parameters in the request body parameter description validation data type name name of the attribute minlength 1 maxlength 32 pattern ^\[a za z]{1,32}$ string description description of the attribute minlength 0 maxlength 256 pattern ^(\[a za z])(\[a za z0 9,\s] )$ string datatype the data type of the attribute valid values string, number, boolean, object, array, money string validation specifies all of the validations that are performed on the attribute when an order of this type is created or updated indexed specifies whether the attribute is indexed filter or search operation on the basis of a custom attribute is only allowed if this field is set as true boolean note some of the core work order attributes that can be updated are listed below pickupdetails returndetails deliverydetails the following sample payload shows how to create work order custom attributes named stringvalidations and intvalidations post /work order/config/attributes { "attributes" \[ { "name" "stringvalidations", "description" "string", "indexed" true, "datatype" "string", "validation" { "range" { "min" 0, "max" 5 }, "regex" "string", "valueoneof" \[ "string123", "string124" ], "required" false } }, { "name" "intvalidations", "description" "int", "indexed" true, "datatype" "number", "defaultvalue" 1, "validation" { "range" { "min" 0, "max" 5 }, "valueoneof" \[ 0,1,2,3,4,5 ], "required" true } } ] } adding work order to an order to add a work order to an order, call the put /{orderid}/work order endpoint the following sample payload shows how to add a work order to an order \[ { "amounttocollectondelivery" { "currencycode" "usd", "amount" 1000 }, "pickupqualitychecks" {}, "collectamountonpickup" true, "description" "testing first workorder", "type" "move containers", "pickupaddress" "location 1234", "attributes" { "stringvalidations" "string124", "intvalidations" 1 }, "containers" \[ "container 001" ] } ] work order lifecycle a work order has the following lifecycle states and sub states created work order has been created in the system inprogress\ scheduled a job has been created for the work order inprogress\ assigned job corresponding to work order has been added to a dispatch inprogress\ active job corresponding to the work order has been started onhold\ onhold logistics provider wants to restrict any further actions to be taken by the operations (for ex payment issues for an order / damage issue for an order) closed\ success work order has been completed successfully closed\ partial work order containers have been partially delivered closed\ failed work order has not been successfully delivered closed\ canceled cancellation request raised by a client is processed