Manage Record Types with SFDX

by Jiri Dvorak - March 29, 2022
Manage Record Types with SFDX

Have you ever faced the task of updating profile assignments of record types? This can be a time-consuming and complex task. Let’s see how we can manage record types with SFDX.

Declarative Record Type Management

We can control the profile assignments from a single page when we create a record type.

Record type profile assignment when created

 

However, this is not available when profile assignments need editing. Currently, Salesforce orgs with many user profiles require drilling down to each profile’s object settings page to access record type assignments. There are also cases when the access to profile assignment of a record type is not available if the profile has limitations due to its user license. Examples of this are the Chatter profiles.  Here we can get into a situation where we are not able to manage the record type effectively in the existing user interface.

Record type deactivation error

Prioritisation

These are the reasons why the Salesforce Trailblazer community has had a long-established idea to improve record type management. The most recent Salesforce prioritisation cycle from January shows just how much the community wants this experience to improve.

January Salesforce prioritization cycle

We are looking at a number one prioritised item in this cycle overall. To guess how much the community is pushing for this change just look at the total column, and the gap between Improved record type management and everything else.

SFDX Record Type Management

But the question is what do we do before any change arrives? We can use SFDX to make the changes efficiently and effectively.

First, you want to create/use a project with manifest. Next, authorise your org and update the manifest package.xml to include your record type and target profiles. To include all profiles you can use the wildcard * as the member. See here in Visual Studio Code.

Manifest package xml

 

Afterwards, you want to run SFDX: Retrieve Source in Manifest from Org. After the retrieve runs, you can open the relevant .profile-meta.xml file and update <recordTypeVisibilities> parameters of visibility and default assignment to the record type.

.profile-meta-xml file recordTypeVisibiliites

This way it is possible to control record type profile assignments for all profiles regardless of their user license. Finally, when we are ready we can run SFDX: Deploy Source in Manifest to Org.

 

We have a tool at hand that allows us to efficiently and effectively manage record types: SFDX.

You can share your feedback or reach out to our team to discuss how this could help you.

Related Content


Get In Touch

Whatever the size and sector of your business, we can help you to succeed throughout the customer journey, designing, creating and looking after the right CRM solution for your organisation