How to deploy Salesforce Record Types

How to deploy Salesforce Record Types

Jason Mann on

Share with

LinkedIn
Twitter

We’ve recently noticed that more users are having issues deploying Record Types to Salesforce. This type of metadata has always been a bit tricky to deploy, and the introduction of Global Value Sets in Winter ‘17 has added a new variable to the mix.

We’ve recently been improving Gearset’s dependency and problem analysis engine to help deal with some of the challenges of deploying record types and picklist fields.

Global Value Set dependencies

The first improvement is that picklist fields that use Global Value Sets now generate a dependency on the Global Value Set, so Gearset will automatically make sure that the Global Value Set is available and up to date on the target as part of the deployment.

Deploying record types with Gearset

Every picklist field must be deployed

Next is dependencies between the Record Type and the fields that it references. To deploy a Record Type, you must also deploy all fields that the Record Type references or Salesforce will fail the deployment with an error.

The addition of Global Value Sets makes this requirement even more confusing still! Salesforce produces an error if the Record Type names a Global Value Set but it isn’t used in any of the fields in the object. The error is very confusing and it will imply that the Value Set isn’t on the target when really it is trying to say that the Value Set, whilst present, isn’t used by any of the fields. Gearset now knows about this and will make sure that all the necessary fields are included in the deployment.

Live eventConvene, Chicago

DevOps Dreamin' Chicago 2024

Find out more

Record Types can contain out-of-date picklist definitions

Finally we will check that all of the definitions in the Record Type are actually associated with object fields and remove any that are not. Sometimes edits in Salesforce can leave definitions behind that no longer reference any fields, and the dependencies can also easily be overlooked when working on the metadata in a source-controlled repository. Previously these issues had to be resolved by modifying the definition on the source, but now, Gearset’s problem analysis will suggest removing the superfluous definitions so that your deployment will succeed.

Deploying record types with Gearset

The Salesforce platform is a powerful one and representing that power in metadata can make for complicated XML files! Gearset’s unique analysis engine understands the metadata and how to transform it to enable successful deployments, so you can get on with your work! Get started with your free 30-day trial today.

Try all of Gearset for free