Skip to content

RecordTypes

Config key: settings.recordTypes

Deletes inactive record types, optionally replacing them by another record type where they are used.

Screenshot

RecordTypes

Pill Field
1 deletions[0].fullName
2 deletions[0].replacement
3 deletions[1].fullName

Use cases

Delete retired record types

A rental company used to track sports cars and SUVs as Vehicle record types. Both were deactivated long ago, but they still clutter the record type lists, the reports and every profile. The Metadata API refuses to delete a record type ("Cannot delete record type through API"), and Setup only deletes an inactive one, asking which record type its records get instead.

This config deletes Sports Car, whose records become Bike records, and Sport Utility Vehicle, whose records lose their record type. Browserforce refuses to delete an active record type: deactivate it first with the Metadata API. Once deleted, a record type only comes back by deploying it again.

{
  "$schema": "https://raw.githubusercontent.com/amtrack/sfdx-browserforce-plugin/main/src/plugins/schema.json",
  "settings": {
    "recordTypes": {
      "deletions": [
        {
          "fullName": "Vehicle__c.SportsCar",
          "replacement": "Vehicle__c.Bicycle"
        },
        {
          "fullName": "Vehicle__c.SUV"
        }
      ]
    }
  }
}

Example

{
  "$schema": "https://raw.githubusercontent.com/amtrack/sfdx-browserforce-plugin/main/src/plugins/schema.json",
  "settings": {
    "recordTypes": {
      "deletions": [
        {
          "fullName": "Account.MyOldRecordType",
          "replacement": "Account.MyRecordType"
        }
      ]
    }
  }
}

Fields

In the field paths, [] stands for the items of a list and * for the entries of an object keyed by name.

Field Type Description
deletions[].fullName string the API name of the RecordType
Required.
deletions[].replacement string optional API name of the replacement RecordType
JSON Schema
{
  "type": "object",
  "properties": {
    "deletions": {
      "default": [],
      "title": "Record Type Deletions",
      "description": "Delete inactive record types",
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "fullName": {
            "type": "string",
            "description": "the API name of the RecordType"
          },
          "replacement": {
            "type": "string",
            "description": "optional API name of the replacement RecordType"
          }
        },
        "required": [
          "fullName"
        ]
      }
    }
  },
  "title": "RecordTypes",
  "description": "Deletes inactive record types, optionally replacing them by another record type where they are used.\n\n![Record Types](https://raw.githubusercontent.com/amtrack/sfdx-browserforce-plugin/main/src/plugins/record-types/screenshot.webp)",
  "examples": [
    {
      "deletions": [
        {
          "fullName": "Account.MyOldRecordType",
          "replacement": "Account.MyRecordType"
        }
      ]
    }
  ]
}

Source code of this setting