Work with objects and fields
Overview
The Skedulo CLI allows you to manage objects and fields efficiently, providing operations such as create, delete, update, and list.
This guide covers best practices for safely managing objects and fields, modifying vocabulary options on standard fields, and understanding reference field behaviors.
Manage objects and fields
Objects and fields represent data structures and attributes within Skedulo. Fields are defined within objects and each object can have multiple custom fields to store various types of data.
The Skedulo CLI allows you to manage these elements via commands that enable you to create, update, retrieve, and delete custom objects and fields. For more on this, see the Work with artifacts section or the artifacts
command reference.
Considerations when deleting objects and fields
Data loss
When you delete an object or field via the Skedulo CLI, it is removed from the system and any associated data is immediately lost forever.
Best practice
Always double-check that you no longer need the object or field and make sure to export and back up any critical data before performing deletions.Reference type fields
When you delete a Lookup field, all corresponding Has-many relationships that reference the deleted Lookup field will also be deleted. However, deleting a Has-many field does not affect the corresponding Lookup field.
For example, if you have two fields:
AssignedResource
: A Lookup field onJobs
that referencesResources
.ResourceJobs
: A Has-many field onResources
that references theAssignedResource
Lookup.
deleting AssignedResource
will also delete ResourceJobs
. However, deleting ResourceJobs
will not delete AssignedResource
.
See the Lookup and Has-many field type documentation for more information about how these fields work.
Modify vocabulary options on standard fields
While you cannot edit the definition of a standard field, you can customize the vocabulary options (i.e., the allowed values) associated with a standard field, such as the AbortReason
field on Jobs
. Standard fields can be found in the object reference or in the Objects & fields section in the settings menu of the Skedulo web app.
For example, the AbortReason
field on Jobs
is a StandardPicklist. You can edit or deactivate existing options, or add new options by following the steps below:
-
Export the current state of the
AbortReason
field by running the following Skedulo CLI command:sked artifacts custom-field get --objectName Jobs --name AbortReason
This command will retrieve the field state and save it as a
.custom-field.json
file. -
Open the exported file (
Jobs-AbortReason.custom-field.json
) in a text editor and modify the existing options, or add new ones. In this example,Weather related
has been added andAppointment missed
has been deactivated:{ "metadata": { "type": "CustomField" }, "objectName": "Jobs", "name": "AbortReason", "field": { "type": "StandardPicklist", "allowedValues": [ { "value": "Customer no show", "label": "Customer no show", "active": true, "default": false }, { "value": "Canceled by customer", "label": "Canceled by customer", "active": true, "default": false }, { "value": "Appointment missed", "label": "Appointment missed", "active": false, "default": false }, { "value": "Weather related", "label": "Weather related", "active": true, "default": false } ] } }
Note
Once a vocabulary item is added to the field, it cannot be deleted. If you remove an allowed value from the state file, the option will be deactivated by setting"active": false
. This means the item is no longer usable and will no longer appear as an option.
-
Once you are satisfied with the changes to the vocabulary options, you can apply the updates by running the following command:
sked artifacts custom-field upsert -f Jobs-AbortReason.custom-field.json
This will update the
AbortReason
field onJobs
with the new vocabulary options you have defined.
Next steps
Now that you’ve managed objects and fields with the Skedulo CLI, check out:
Feedback
Was this page helpful?