Many companies struggle when handling customers' data. Some of them experience issues like accessibility which limits users and customers from accessing certain customers' data, and the application not working well. When the business grows, and there is an increase in demand, many businesses have to find solutions to fix the issues. Since Salesforce has many features and tools that help companies in data management. Developers can create several tools, and that is when they use custom settings to solve this. It improves data accessibility and management across organizations, reducing operational costs and improving performance. Knowing how to use and implement custom settings as a developer is helpful to the customers and the company operations. The article will look at different aspects of custom settings and how to implement them.
Custom settings are objects that developers use to create different customized sets of data that have an association with the company, user, or profile. There are options where you can set the custom settings to either public or private. Some of the areas where custom settings get applied are the fields, Apex, flows, SOAP API, and validation rules. The data created by customer meetings must meet the user's needs, allowing users to access it faster using the application cache.
When you have data using the settings, users do not need to use database querying languages or the Salesforce Object Query Language to get the data. It uses custom objects which developers build to fix all the business processes and information that does not work well with the Salesforce objects. Many businesses should learn how to use custom settings and benefit from them. Some of the custom fields that the developers use are currency, checkbox, phone number, date and time, URL, text, number, textarea, percent, e.t.c.
The settings can lack some fields like lookups, formulas, picklists, e.t.c. which are important to use. It also lacks page layouts that developers can use. The lack of layouts forces developers to use visual force pages to meet the requirements. When working with these settings, there are no rules that one must use.
Wish to make a career in the world of salesforce? Start with HKR'S salesforce online training !
We have two types of custom settings. This are:
It works with how the custom objects function. The main purpose of this custom setting is to cache all the data. It reduces the cost of the data due to easy access to the data. It makes the accessing of static data across the company easy. It eliminates the use of SOQL queries which are sometimes against the limits. What the users need to do is put the data in this type of setting without writing any SOQL for accessing the data. The data provided in the list settings does not vary according to the users or profiles, making it impossible for anyone in the company to access it.
The data is useful to different departments of the company. It enables the developers to have reusable data which everyone can access in the company. This setting is good for the type of data sets that companies use mostly in their salesforce applications.
We create a list custom settings by following the steps below:
Get ahead in your career with our salesforce Tutorial
Hierarchy custom settings help in ensuring the majority have the advantages for users. Its logic is efficient and enables users to customize their settings using different settings and rows. The settings match particular profiles and contacts that will meet the requirements of the company's clients. This type of setting can scan all the client companies and their necessary profiles, look at the tasks handled by different people, and ensure that the final values shown to the user are more accurate and specific to what they want.
It makes the companies make certain settings to several profile settings meant for the users, which get subjected to the user settings individually. They help the companies and their clients to define all their data hierarchically. This type of setting is suitable when defining defaults used by specific Salesforce applications, relying on the users, companies' needs, and certain profiles. Hierarchy custom settings sync well with the Salesforce functionalities since they are highly customizable, and you can change them to meet the customer's needs.
We can create an example of a Hierarchy Custom Setting using the steps below:
Log in to your Salesforce CRM, locate the Custom Settings, and several fields require one to fill. Under the label and Object name, input worker for both fields. Under the Settings section, choose between list and Hierarchy. Under Visibility, set it to public, enter the Description, then click on the Save button.
In some cases, you find that some parts of the settings section got disabled, you need to navigate to the schema settings and change the settings to enable it. Go to the custom fields and create the field by entering data into Field Label, Data type, API name, and action. To add data, hover over the Action settings to add more data.
Using custom settings in the Salesforce CRM and applications has several benefits. This include :
Wish to make a career in the world of salesforce? Start with HKR'S salesforce online training in Canada!
There are several ways of fetching custom settings in Salesforce. These methods are:
To fetch custom settings, it depends on the type of custom settings. Let us look at all types of settings.
How to fetch data on list custom settings.
We use the getAll() method to fetch certain custom fields found in List settings. The method returns a list of the names and all the setting records i.e
Map<String_data_set_name, CustomSettingApiName> var =
CustomApiName.getAll();
Eg: Map<String, Worker__c> worker = Worker__c.getAll();
We use the getValues() method to fetch the values that match with a certain dataset. It normally works for both the custom settings i.e
CustomApiName var = CustomApiName.getValues(name of dataset);
For example Worker__c stud = Worker__c.getValues('Mark');
To fetch values for hierarchy custom settings, we use the methods below to achieve the same:
We use getOrgDefaults() method to return the data set records for the company i.e
CustomApiName var = CustomApiName.getOrgDefaults();
We use getInstance(input the user id or the profile id) method to get data records for a certain user or profile details i.e
CustomApiName var = CustomApiName.getInstance(userId/ProfileId);
We use the getInstance() method to get the records for the logged users.
CustomApiName var = CustomApiName.getInstance();
Some of the limitations of using Salesforce include:
Click here to get frequently asked Salesforce Interview Questions & Answers
Conclusion
When creating custom settings in a distributed package, you must develop several builds for populating the custom settings with data after the package installation. Implementing custom settings is easier and straightforward and has many benefits for the users. The article has enabled you to better understand the two types of custom settings, the advantages, and how to install them in your application.
Related articles:
Batch starts on 28th Sep 2023, Weekday batch
Batch starts on 2nd Oct 2023, Weekday batch
Batch starts on 6th Oct 2023, Fast Track batch
They help in customizing the company data.
Salesforce can accept up to 300 fields per custom setting.
The data gets stored using the objects or the application cache.
Customer settings are configuration tables that rely on the configuration file, while custom objects are record tables that use SQL or any other database.