Work with artifacts

How to use the Skedulo CLI to create, retrieve and delete artifacts.

Overview

The primary use of the Skedulo CLI is managing artifacts. An artifact represents an instance of a configuration element, such as a definition of custom objects and fields for storing data or custom pages and templates to build custom user interfaces.

Manage artifacts

Artifacts can be exported, created, updated, deleted, and listed using the Skedulo CLI.

Artifacts can either be a single file or a bundle. In the case of a single file (known as a state file), the metadata and the artifact content are in a single file. For example, custom fields are single-file artifacts.

Bundled artifacts contain a state file and a bundle folder. The state file simply contains some metadata and a reference to the folder containing the rest of the files. Functions, web extensions, and mobile extensions are examples of bundled artifacts.

Each artifact has slightly different required flags and not all artifacts support all operations or platforms. For more on this see the command reference and the Artifact compatibility table below.

For this example, we will use a “custom field” artifact, as it is a single-file artifact and it supports all operations.

Export artifact

If we have a custom text field called RiskAssessmentNotes on the Jobs object, we could use the following command to export it:

$ sked artifacts custom-field get --name RiskAssessmentNotes --objectName Jobs --outputdir .

This command will retrieve the custom field named RiskAssessmentNotes from the Jobs object and place it in to the current directory (.), giving us a file called Jobs-RiskAssessmentNotes.custom-field.json which will look as follows:

{
  "metadata": {
    "type": "CustomField"
  },
  "objectName": "Jobs",
  "name": "RiskAssessmentNotes",
  "field": {
    "type": "TextArea",
    "description": "",
    "display": {
      "label": "Risk Assessment Notes",
      "order": 0,
      "isAlert": false,
      "showIf": null,
      "showOnDesktop": true,
      "showOnMobile": true,
      "editableOnMobile": true,
      "requiredOnMobile": false
    },
    "constraints": {
      "unique": false,
      "required": false,
      "accessMode": "ReadWrite",
      "maxLength": 1023
    }
  }
}

Create artifact

If we wished to create a new field, we can simply copy our previous example, rename it to Jobs-CustomerNotes.custom-field.json and edit the name property to create a new field called CustomerNotes on Jobs (or save the below example):

{
  "metadata": {
    "type": "CustomField"
  },
  "objectName": "Jobs",
  "name": "CustomerNotes",
  "field": {
    "type": "TextArea",
    "description": "",
    "display": {
      "label": "Risk Assessment Notes",
      "order": 0,
      "isAlert": false,
      "showIf": null,
      "showOnDesktop": true,
      "showOnMobile": true,
      "editableOnMobile": true,
      "requiredOnMobile": false
    },
    "constraints": {
      "unique": false,
      "required": false,
      "accessMode": "ReadWrite",
      "maxLength": 1023
    }
  }
}

Once we have our file called Jobs-CustomerNotes.custom-field.json we can create our new field by running the following:

sked artifacts custom-field create --filename Jobs-CustomerNotes.custom-field.json

Update an artifact

If we wanted to update our RiskAssessmentNotes field to increase it’s length, we could edit the maxLength property under constraints as shown below:

{
  "metadata": {
    "type": "CustomField"
  },
  "objectName": "Jobs",
  "name": "RiskAssessmentNotes",
  "field": {
    "type": "TextArea",
    "description": "",
    "display": {
      "label": "Risk Assessment Notes",
      "order": 0,
      "isAlert": false,
      "showIf": null,
      "showOnDesktop": true,
      "showOnMobile": true,
      "editableOnMobile": true,
      "requiredOnMobile": false
    },
    "constraints": {
      "unique": false,
      "required": false,
      "accessMode": "ReadWrite",
      "maxLength": 2047
    }
  }
}

Then, once we have saved our changes we can run to deploy the changes and update the field:

sked artifacts custom-field update --filename Jobs-RiskAssessmentNotes.custom-field.json

Delete an artifact

If we no longer need our RiskAssessmentNotes field, we can delete it by running:

sked artifacts custom-field delete --name RiskAssessmentNotes --objectName Jobs

List artifacts

If we wish to see all custom fields on a given object, we can run:

sked artifacts custom-field list --objectName Jobs

The list artifacts command

Next steps

Now that you’ve deployed artifacts with the Skedulo CLI, check out:

Work with packages

Skedulo CLI command reference

Help and troubleshooting