Box Developer Documentation

Join BoxWorks 2024 to discover what's possible with content and AI!

Register now!

String metadata field

String metadata field

A metadata field of type string is displayed to a user as a standard text-field.

String field

Create a string field

A string field can be added to a metadata template either when creating a metadata template, or when updating a template with the addField operation.

The required attributes for a string field are a type, a displayName, and a key.

{
  "scope": "enterprise",
  "displayName": "Customer",
  "fields": [
    {
      "type": "string",
      "key": "name",
      "displayName": "Name",
      "description": "The customer's legal name",
      "hidden": false
    }
  ]
}

Optionally, a description can be provided that is shown to a user in the UI, and the field can be set to hidden to hide it from users in the web and mobile apps.

Update a string field

A string template field can be updated by updating the template it belongs to. Updates to templates happen through operations to ensure that any template that is already assigned to a file or folder is updated as well.

When updating a string metadata field, the only relevant operation is the editField operation, which can be used to change the field's key, displayName, description, and hidden values.

[
  {
    "op": "editField",
    "fieldKey": "name",
    "data": {
      "displayName": "Customer Name",
      "description": "The contact name at the customer",
      "key": "customer_name",
      "hidden": true
    }
  }
]

This will affect existing instances of this template.