Work with objects and fields

Best practices and considerations when working with objects and fields using the Skedulo CLI.

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.

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:

  1. AssignedResource: A Lookup field on Jobs that references Resources.
  2. ResourceJobs: A Has-many field on Resources that references the AssignedResource 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:

  1. 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.

  2. 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 and Appointment 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
          }
        ]
      }
    }
    
  1. 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 on Jobs with the new vocabulary options you have defined.

Next steps

Now that you’ve managed objects and fields with the Skedulo CLI, check out:

Work with artifacts

Work with packages

Skedulo CLI command reference

Help and troubleshooting