Skip to main content
20 votes
Accepted

Custom setting Setting type not visible

You Can enable list custom setting schema Setting Page Setup > schema Setting Page > List custom Setting
Akshat's user avatar
  • 682
20 votes
Accepted

Eliminate query on Custom metadata type?

Edit: The rows themselves now count against the 50k SOQL row limit, although they do not count against the 100 SOQL query limit. To access custom metadata records without consuming SOQL rows is to use ...
sfdcfox's user avatar
  • 497k
15 votes

What is the difference between Custom Settings and Custom Metadata Types

I've done quite a bit of research on Custom Metadata Types vs Custom Settings, and I've found that in only a few cases are Custom Settings more useful. Custom Metadata types have a number of ...
SFDC Neuf's user avatar
  • 1,537
13 votes
Accepted

protected and public custom settings

There's no difference between public and protected custom settings in an unmanaged package scenario. Anyone with Customize Application can modify the values of the custom settings. For a managed ...
sfdcfox's user avatar
  • 497k
13 votes

Eliminate query on Custom metadata type?

Just An Update: Salesforce is coming up with new methods to retrieve custom metadata type records in a similar way custom setting records are retrieved. Yes, Without SOQL query. and It's happening in ...
Akshay Poddar's user avatar
12 votes
Accepted

Custom MetaData Types reference in Formula Field

Unfortunately, you can't reference custom metadata types in formulas at all. Their primary purpose is to provide metadata that's easy to package and transport between orgs, and primarily intended for ...
sfdcfox's user avatar
  • 497k
11 votes
Accepted

How to retrieve Custom Settings from Sandbox to a local SFDX Project?

They're the same as a CustomObject. You can retrieve one via the terminal: sfdx force:source:retrieve -m CustomObject:CustomSettingName__c In the Org Browser, they'll also be listed under Custom ...
sfdcfox's user avatar
  • 497k
9 votes
Accepted

Activate and Deactivate trigger using Custom Setting

One Checkbox Custom Setting field should be sufficient to toggle between active and inactive states for the trigger. First thing in your trigger, check the hierarchy custom setting value and return ...
Daniel Ballinger's user avatar
9 votes

Where should we store username/password/endpoint…in Salesforce?

Better to use Named Credentials Named Credentials are a safe and secure way of storing authentication data for external services called from your apex code such as authentication tokens A named ...
Santanu Boral's user avatar
9 votes
Accepted

Build an XML with a custom settings for migration in salesforce org to org

They are ordinary CustomObject entries, just as if you were migrating fields from Account or MyCustomObject__c. <?xml version="1.0" encoding="UTF-8"?> <Package xmlns="http://soap.sforce.com/...
sfdcfox's user avatar
  • 497k
8 votes

How to get Custom Settings in Apex Test code?

The following worked for me. The code that uses a token: Map<String, ServiceTokens__c> setting = ServiceTokens__c.getall(); ServiceTokens__c token = setting.get('Token__c'); ...
dev.e.loper's user avatar
8 votes

Custom MetaData Types reference in Formula Field

You can reference CMT records in formula fields starting with the Winter '19 release. It follows the same syntax as in validation rules: $CustomMetadata.MyCustomSetting__mdt.DeveloperName....
Vladimir Gerasimov's user avatar
8 votes
Accepted

Test Method throwing null pointer exception on custom setting

You have to create your own test data. Isolation of Test Data from Organization Data in Unit Tests Starting with Apex code saved using Salesforce API version 24.0 and later, test methods don’t have ...
Adrian Larson's user avatar
  • 151k
8 votes

Validate if a custom object or custom settings is used anywhere

What you're looking for is this feature (dependency API), but it's not available publicly yet. For now, the only sane way to do a check is to use a metadata deployment with a "check-only" option to ...
sfdcfox's user avatar
  • 497k
7 votes

Custom Setting in Validation Rule

The answer is NO - only hierarchical settings. However, there is VLOOKUP formula function that can reference a custom object where your state and country names can exist. See the zipcode example in ...
cropredy's user avatar
  • 72.1k
7 votes

Custom MetaData Types reference in Formula Field

We are adding support for custom metadata type in formulas. In Spring '18 you will be able to reference CMT records in validation rules (pilot) with the future addition of formula fields, default ...
Vladimir Gerasimov's user avatar
7 votes

What is the use of "View All Custom Settings"?

This is basically adding an object-level security layer that didn't exist. Apex can always access Custom Settings, just as it can always query any object regardless of the user's object-level ...
Charles T's user avatar
  • 11k
6 votes
Accepted

Visualforce Tab Access?

I could find the VF tab in the Object Settings .Its confusing that Tab settings are mixed with Object Settings . My sample VF tab showed up Here is the Settings
Mohith Shrivastava's user avatar
6 votes

Can you use a string to getinstance of custom setting?

You can just get a value by name like this: list<string> names = new list<string>{'shay', 'austin'}; for (string name : names) { sendgridsettings__c sgs = sendgridsettings__c....
Keith C's user avatar
  • 136k
6 votes
Accepted

Can FeatureManagement.changeProtection() be used to Protect any Custom Object?

After some guidance by Salesforce, I figured it out: Winter 18 introduced the ability to "Protect" regular Custom Objects, in addition to the preexisting ability to Protect Custom Settings and Custom ...
zachelrath's user avatar
  • 9,573
6 votes
Accepted

Fetch all custom settings

There is no decent way to do it, but can be achieved using a describe call. Describe call result has a method that indicates whether it is an SObjectType or a normal SObject or a Custom Setting. We ...
Pranay Jaiswal's user avatar
6 votes

Can I delete Custom Settings in Managed package salesforce?

Deleting the custom setting will not help you. A name in a given component area (e.g. a CustomObject or ApexClass) can never be reused. Once you upload a component, if you then delete the item, that ...
sfdcfox's user avatar
  • 497k
6 votes
Accepted

Is it possible to get a Custom Setting without the cost of a SOQL query and at the same time do it DYNAMICALLY without hardcoding the setting?

There's no way to do this directly; there's no unique common parent type or interface, we can't access namespace properties dynamically, we don't have proper language reflection, etc. Basically, the ...
sfdcfox's user avatar
  • 497k
5 votes
Accepted

How to store sensitive data in Salesforce (for AppExchange package)?

We also received same issue. There are several ways to get rid of this problem(But i preferred first approach): Use of Protected custom metadata types: If the creds are not dynemically generated then ...
Mr.Frodo's user avatar
  • 5,812
5 votes

Edit Custom Metadata Records from a Managed Package

It's possible to edit subscriber-controlled fields on public records of public custom metadata types via the metadata API, even if those records are included in a managed package. The main thing you ...
Avrom Roy-Faderman's user avatar
5 votes
Accepted

custom setting coverage in test class

Just like normal SObjects, your Test Context doesn't have access to the custom setting records already in the database. You can perfectly, insert a new Custom Setting record, in your test context ...
developer__c's user avatar
  • 1,307
5 votes

How to create Hierarchy custom settings in Apex

To do this with a hierarchy you have to change the 'SetupOwnerId' so the entry recognizes the User or Profile to apply the setting to. As a best practice I like to put the label in parenthesis in the ...
NickZeus's user avatar
  • 187
5 votes
Accepted

How to show Columns of Visualforce Page Based on Custom Settings Fields?

Use a Field Set instead. It was designed with this scenario in mind. Working with Field Sets You can use dynamic bindings to display field sets on your Visualforce pages. A field set is a grouping of ...
Adrian Larson's user avatar
  • 151k
5 votes
Accepted

custom setting in Apex Trigger

Your code does not look like it will have any bulk issues. You do need to check if the setting is null though, since you are not guaranteed to have a CountryInfo__c record for a given key. ...
Adrian Larson's user avatar
  • 151k
5 votes
Accepted

Custom Settings and fields

You use the CustomObject.getInstance method. You can provide the Organization Id, the Profile Id, or a User Id. Using this method, you can get the specific values for each User Id or Profile Id that ...
sfdcfox's user avatar
  • 497k

Only top scored, non community-wiki answers of a minimum length are eligible