
- Introduction to Custom Settings in Salesforce
- Types of Custom Settings
- Difference Between List and Hierarchy Custom Settings
- Creating Custom Settings
- Adding Fields to Custom Settings
- Using Custom Settings in Apex
- Accessing Custom Settings in Formulas
- Data Management with Custom Settings
- Limitations of Custom Settings
- Custom Metadata vs Custom Settings
- Best Practices for Using Custom Settings
- Real-World Applications of Custom Settings
Introduction to Custom Settings in Salesforce
Custom Settings in Salesforce are a powerful feature that allows you to store custom data at the organization, profile, or user level, making it easier to manage and configure your Salesforce applications. Unlike custom objects, custom settings provide a more efficient way to manage data that is typically used in apex code, validation rules, workflows, and formulas. They are designed to be accessed easily by developers and administrators without consuming the organization’s storage limits. There are two types of custom settings: List Custom Settings, which store a set of static data accessible across the organization, and Hierarchy Custom Settings, which allow data to be customized per user, profile, or org level. Explore our Salesforce Training can provide in-depth knowledge on how Salesforce Training to effectively implement and use these settings in real-world scenarios. This flexibility ensures that different users or profiles can have personalized configurations. Custom settings can be used for a variety of use cases, such as creating reusable configuration settings for complex business logic, managing third-party API keys, or controlling feature toggles within an app. One of the biggest advantages of custom settings is that they provide faster access to frequently used data compared to custom objects, improving performance. In essence, custom settings enable more efficient and scalable Salesforce customization while keeping data accessible and easy to manage.
To Explore Salesforce in Depth, Check Out Our Comprehensive Salesforce Training To Gain Insights From Our Experts!
Types of Custom Settings
- List Custom Settings: These store global, static data that can be accessed by all users in the organization. List Custom Settings are best suited for storing values that are consistent across the entire organization, such as default configurations, application-wide parameters, or feature toggles.
- Hierarchy Custom Settings: This type allows customization of data at different levels, such as the user, profile, or org level. Hierarchy Custom Settings enable you to create specific configurations for different user groups, making it ideal for scenarios where different profiles or users need tailored settings, such as regional preferences or access controls.
- Data Storage and Access: Custom Settings are stored in Salesforce’s metadata, ensuring they don’t count against the organization’s storage limits. This makes them a highly efficient option for storing small amounts of data without impacting overall storage capacity. Learn more about the Top Features of Salesforce Lightning.
- Easy Access in Apex: Custom Settings can be easily accessed in Apex code without requiring complex queries. This direct access allows for faster retrieval and processing of configuration data, making your Apex code cleaner and more efficient by reducing the need for SOQL queries.
- No Storage Impact: Unlike custom objects, Custom Settings do not consume valuable storage space in Salesforce. This is especially beneficial for organizations looking to optimize their data storage usage while still needing to store and access frequently used configuration data.
- Use in Formulas and Validation Rules: Custom Settings can be referenced directly in formula fields, validation rules, workflows, and process builder flows. This functionality enables dynamic configuration, allowing you to implement logic that adapts to specific settings, improving your automation and business rules management.
Custom Settings in Salesforce offer a versatile way to store custom data that can be accessed across the platform without affecting storage limits. They are highly valuable for developers and administrators who need to create reusable configurations or manage settings dynamically at different levels. By leveraging Custom Settings, you can streamline business logic, improve performance, and tailor user experiences based on specific needs. There are two main types of Custom Settings, each serving distinct purposes depending on the requirement. Here’s a deeper look into each type and its advantages:
Difference Between List and Hierarchy Custom Settings
List Custom Settings and Hierarchy Custom Settings are two types of custom settings in Salesforce, each serving distinct purposes based on how data is stored and accessed. List Custom Settings stores data that is global and accessible across the entire organization. The data stored in List Custom Settings is static, meaning it is the same for all users, profiles, and organizations. This makes it ideal for storing default settings or configurations that are consistent throughout the system, such as application-wide parameters or third-party API keys. In contrast, Hierarchy Custom Settings offer more flexibility by allowing data to be customized at the user, profile, or org level. For more details, refer to the Salesforce Developer Roles & Responsibilities guide. This means that the values stored in these settings can be tailored to meet the specific needs of different users or groups within the organization. For example, a company might use a Hierarchy Custom Setting to define different regional preferences, where each user or profile in different regions has unique configuration data. This provides a more personalized approach and allows for specific control over how settings are applied across various levels in Salesforce.
Do You Want to Learn More About Salesforce? Get Info From Our Salesforce Training Today!
Creating Custom Settings
Creating Custom Settings in Salesforce is a straightforward process that allows administrators and developers to configure reusable data for their organization. To create a Custom Setting, navigate to the Setup menu, search for “Custom Settings” in the Quick Find box, and select Custom Settings under the Build section. From there, click New to define a new Custom Setting by specifying its type, either List or Hierarchy, and providing a name, label, and description. After the Custom Setting is created, you can add custom fields to define the data you want to store. For example, you might add fields for API keys, feature flags, or other settings relevant to your app. Once the Custom Setting is created, it can be accessed via Apex code, validation rules, workflows, or formula fields, enabling seamless integration into your business logic and processes. The data stored in these settings can then be customized based on your organizational needs, with Hierarchy Custom Settings allowing you to set different values at the user, profile, or org level for added flexibility.
Adding Fields to Custom Settings
- Navigate to Custom Settings: Go to Setup, search for “Custom Settings” in the Quick Find box, and click on Custom Settings under the Build section.
- Select the Custom Setting: Choose the Custom Setting to which you want to add fields. Click on the name of the Custom Setting to open its details page.
- Click on “New” Field: On the Custom Setting detail page, click the New button under the Custom Fields section to begin creating a new field.
- Choose Field Type: Select the appropriate field type (e.g., Text, Number, Date, Checkbox, etc.) based on the type of data you want to store in the field. For best practices on testing your configurations, check out the Effective Test Classes in Salesforce.
- Enter Field Details: Provide a field label, field name, and any necessary details such as length, picklist values, or default values, depending on the field type chosen.
- Save the Field: After entering the required information, click Save to add the field to the Custom Setting. The new field is now available for storing data and can be accessed in Apex, validation rules, workflows, or formula fields.

Using Custom Settings in Apex
Using Custom Settings in Apex provides a powerful way to store and access configuration data without the need for complex queries or consuming storage limits. These settings are ideal for managing application-wide parameters or user-specific configurations, allowing for more efficient and scalable code. Custom Settings are designed to be easily accessed in Apex without the overhead of querying custom objects, which can improve performance. In Apex, developers can reference List Custom Settings to retrieve global configuration values that apply to the entire organization. These values are stored centrally and remain consistent across all users and profiles. For more dynamic configurations, Hierarchy Custom Settings allow data to be customized at the user, profile, or org level. To explore career paths in the ecosystem, check out the Become a Salesforce Consultant guide. This makes it possible to tailor settings based on specific needs, like different preferences or access controls for various user groups or regions. By using Custom Settings in Apex, you can simplify your code and avoid repetitive configuration logic. For example, feature flags, API keys, or any other settings that need to be shared across different parts of the application can be stored in Custom Settings and accessed easily in Apex. This reduces the need for hardcoding values, making your code more maintainable and adaptable to future changes. Overall, integrating Custom Settings with Apex is an excellent way to create flexible, efficient, and high-performance Salesforce applications.
Accessing Custom Settings in Formulas
Accessing Custom Settings in formulas in Salesforce provides a powerful way to incorporate dynamic configuration data into fields, validation rules, workflows, and other business logic. Custom Settings, whether List or Hierarchy, can be directly referenced in formulas to simplify the management of business rules and enhance flexibility. In formulas, you can use the $Setup global variable to access Custom Settings. For List Custom Settings, you can reference specific values that are consistent across the organization, while for Hierarchy Custom Settings, you can access data that is tailored to specific users, profiles, or the organization itself. Salesforce Training helps professionals understand how to leverage these settings effectively for scalable and customized solutions. This ability allows administrators to implement logic based on configurable values, such as checking if a feature is enabled, applying regional rules, or using dynamic parameters. By incorporating Custom Settings into formulas, organizations can create more maintainable and scalable business logic, as changes to the settings only need to be made in one place rather than updating individual formulas or processes. This approach improves efficiency and ensures that your configuration settings are consistent throughout the Salesforce platform.
Preparing for a Salesforce Job Interview? Check Out Our Blog on Salesforce Interview Questions and Answers
Data Management with Custom Settings
- Efficient Data Storage: Custom Settings are stored separately from standard and custom objects, ensuring they do not count against the organization’s object storage limits. This is especially useful for organizations with a high volume of data or many custom configurations.
- Centralized Configuration Management: By storing configuration data in Custom Settings, administrators and developers can manage settings centrally, reducing the need to hardcode values in multiple locations across the platform.
- Data Customization by Profile or User: With Hierarchy Custom Settings, you can customize data based on user profiles, individual users, or the organization level, ensuring that different groups have personalized access to settings tailored to their needs.
- Easy Access and Retrieval: Custom Settings can be accessed directly in Apex, formula fields, validation rules, and workflows, enabling seamless integration of configuration data into business logic with minimal code and overhead.
- Improved Performance: Since Custom Settings do not require complex SOQL queries, data retrieval is faster and more efficient, especially when used in Apex or formulas, leading to improved performance in your Salesforce applications.
- Simplified Data Updates: When you need to change a configuration or setting, you only need to update the value in the Custom Setting rather than updating individual records, workflows, or code, simplifying the process and reducing maintenance time.
Data Management with Custom Settings in Salesforce offers an efficient way to store and manage reusable configuration data without consuming significant storage space. Here are the key points on how Custom Settings help with data management:

Limitations of Custom Settings
While Custom Settings are a powerful feature in Salesforce for managing reusable configuration data, they do come with certain limitations. One of the main restrictions is that Custom Settings cannot store large amounts of data like custom objects can. They are designed for small, configuration-related data, meaning they are not ideal for complex data models or storing large volumes of records. Additionally, Custom Settings cannot be used in reporting, so they cannot be included in standard Salesforce reports or dashboards. Another limitation is that, while List Custom Settings store data globally across the organization, they are not customizable at the user or profile level. To enhance data organization in reports, explore the Mastering Bucket Fields in Salesforce. On the other hand, Hierarchy Custom Settings provide this level of customization but are still limited to configuration data and cannot be used to store more complex, dynamic data. Custom Settings are also not suited for transactional data, such as records that change frequently or contain relational data. Lastly, they can only store text, number, date, or checkbox fields, limiting the types of data that can be saved compared to other Salesforce data structures. Despite these limitations, Custom Settings remain a valuable tool for handling simple configuration and application-wide settings efficiently.
Custom Metadata vs Custom Settings
-
Purpose:
- Custom Metadata: Primarily used to store configuration data that needs to be deployed across different environments (e.g., from sandbox to production). It’s ideal for app configurations that can be packaged and deployed as part of an app.
- Custom Settings:Used to store configuration data that is accessed at runtime and typically changes per organization or user. It’s great for reusable configuration that doesn’t need to be deployed across environments. Deployment:
- Custom Metadata: Supports deployment through changesets or metadata API, making it suitable for packaging and deploying configurations across different Salesforce environments.
- Custom Settings: Data in Custom Settings does not support deployment directly, so it’s not easily transferable between environments. Settings must be manually set or migrated. Storage:
- Custom Metadata: Stored in the metadata layer, and doesn’t count against the organization’s storage limits, which is beneficial for large, reusable configuration data.
- Custom Settings: Stored in the data layer and do not count against the storage limits, making them better suited for smaller data volumes. Types:
- Custom Metadata: Only one type is available – it’s metadata-based and flexible for larger, reusable configurations.
- Custom Settings: Offers two types – List Custom Settings (global access) and Hierarchy Custom Settings (user/profile-specific access). Access in Apex:
- Custom Metadata: Can be accessed in Apex, but metadata is generally read-only. Custom Metadata is best used when you need to store configurations that won’t change frequently.
- Custom Settings: Can be accessed and modified easily in Apex, with both List and Hierarchy settings providing flexibility in accessing global or user-specific data. Use Cases:
- Custom Metadata: Ideal for managing settings related to app configurations, APIs, integration setups, or any data that needs to be packaged and transferred across environments.
- Custom Settings: Best for handling runtime configuration data, feature toggles, and organization-level or user-specific settings that may change dynamically.
Would You Like to Know More About Salesforce? Sign Up For Our Salesforce Training Now!
Best Practices for Using Custom Settings
When using Custom Settings in Salesforce, it’s important to follow best practices to ensure optimal performance, scalability, and maintainability of your configurations. First, always choose the appropriate type of Custom Setting for your use case: use List Custom Settings for global, organization-wide settings that don’t change frequently, and Hierarchy Custom Settings for user-specific or profile-specific configurations. Avoid using Custom Settings for large data sets or complex transactional data, as they are best suited for lightweight, configuration-related information. Make sure to leverage the $Setup global variable to access Custom Settings in formulas and Apex, as this improves performance and minimizes the need for complex SOQL queries. Additionally, to maintain flexibility and avoid hardcoding values, store settings such as API keys, feature flags, and configuration parameters in Custom Settings rather than directly in code. For working with text-based data, refer to the String Class in Salesforce guide. It’s also essential to document your Custom Settings and provide clear naming conventions for fields and values to make it easier for other team members to understand and maintain. Lastly, keep in mind the limitations of Custom Settings, particularly in terms of storage, and consider using Custom Metadata if you require configurations that need to be deployed across different Salesforce environments. By following these best practices, you can ensure efficient, scalable, and easily maintainable use of Custom Settings in your Salesforce applications.
Real-World Applications of Custom Settings
Custom Settings in Salesforce offer a range of real-world applications that enhance the flexibility and efficiency of Salesforce applications. One common use case is for feature toggles, where organizations can enable or disable specific functionality across their Salesforce environment without modifying code. For example, a company may use a Custom Setting to control whether a new feature or integration is active for certain users or regions.Custom Settings are also frequently used for API key storage; instead of hardcoding API credentials into Apex code, they can be stored in Custom Settings and accessed securely across the organization, reducing the risk of exposure and simplifying updates.Explore our best practices like these to help Salesforce Training developers build more secure and maintainable applications. Additionally, Custom Settings can be employed in regional configurations, where different user groups or profiles may require different settings, such as specific tax rates or business logic, which can be customized with Hierarchy Custom Settings. They also support process automation by storing configuration values for workflows, validation rules, or formula fields, enabling easy updates without having to modify underlying automation logic. In summary, Custom Settings offer a practical solution for managing configurations, improving performance, and keeping Salesforce applications scalable and adaptable to evolving business requirements.