Questions tagged [customsetting]

Custom settings are similar to custom objects and enable application developers to create custom sets of data, as well as create and associate custom data for an organization, profile, or specific user.

Filter by
Sorted by
Tagged with
67
votes
3answers
18k views

What is the difference between Custom Settings and Custom Metadata Types

Summer '15 is going to include the GA release of Custom Metadata Types. See Introducing custom metadata types: the app configuration engine for Force.com Are Custom Metadata Types intended as a ...
29
votes
1answer
21k views

Populating Custom Settings field using Apex

I'm trying to populate/set/put/initialize a custom setting's field with a calculated value within my apex code. The field type is number. Is there a way to do this?
28
votes
2answers
36k views

How to get Custom Settings in Apex Test code?

I have a custom setting used by a visual force page to load error messages based on a code value. In my test code for the page I have this statement Integer howMany = Message__c.getAll().values()....
25
votes
2answers
4k views

Generating a guaranteed contiguous series of numbers

I am looking at a solution to providing a guaranteed contiguous sequence of numbers. This cannot be achieved via autonumber fields as numbers in the series are consumed by failed validations etc. - ...
23
votes
2answers
7k views

custom setting getAll() versus SOQL

Does anyone have any background on which and when using the built in getAll() method for custom settings is better than just using traditional soql? I am aware that getAll retrieves from the cache ...
20
votes
2answers
1k views

Why are Custom Settings lookups not counted against SOQL Query limits?

Custom setting documentation says "All custom settings data is exposed in the application cache, which enables efficient access without the cost of repeated queries to the database" so does this mean ...
18
votes
1answer
15k views

Custom setting List vs Hierarchy

What is the difference between Custom Setting Type "List" and "Hierachy"?
15
votes
2answers
13k views

How to create Hierarchy custom settings in Apex

I need to create Hierarchy custom settings in my test class to avoid the seeAllDate = TRUE Little confused on how to create Hierarchy custom settings. Looked at the docs and other questions but don't ...
15
votes
4answers
8k views

Giving users access to a specific custom setting without granting them Customize Application access

I'm working on a VF page to give some users access to certain custom settings without given them the entire Customize Application access. Is there anyway to edit and commit data into the system as an ...
14
votes
1answer
225 views

API 31.0 breaking change in namespaced Visualforce $Setup global

Has anyone encountered this problem when evaluating $Setup global variable in Visualforce? If, in an organization with a namespace prefix, I have a hierarchy Custom Setting like the following, it ...
13
votes
3answers
27k views

Retrieving Values from Custom Settings

I have created a Custom Settings 'Tal_Source_Map__c' which has 4 fields. SF_Source_Type__c SF_Source_Sub_Type__c Tal_Source_Type__c Tal_Source_Type__c Combination of SF_Source_Type__c and ...
13
votes
3answers
3k views

Unable to insert new records into “hierarchy” type Custom Setting

**Update Oct 23 2013: The fix to Known Issue W-1890544 is now being rolled out to sandboxes. I just verified by creating a brand new sandbox and I'm now able to insert new records into "Hierarchy" ...
13
votes
2answers
13k views

How to access custom settings in test class without using the seealldata?

I want to use a custom settings inside a test class, without using the SeeAllData=true What are the options I have? How can I accomplish it with a reasonable solution?
13
votes
2answers
852 views

Internal Server Error Accessing Org-Default Custom Setting In Test Method - Problem With Currency Values

This is driving me slightly crazy. I have a hierarchy type custom setting which has a currency field. Inside a trigger I do the following: Global_Settings__c gs = Global_Settings__c.getOrgDefaults();...
12
votes
2answers
225 views

Are Custom Settings included in a Database.rollback()?

Apex has a Transaction Control system for rolling back changes to SObjects. Are Custom Settings included in a rollback? (To be more clear, are Custom Settings reverted to the state that they were in ...
11
votes
1answer
943 views

Dynamic get doesn't work on Custom Settings?

One of the most basic and versatile sObject methods is get. For example: My_Object__c record = [SELECT Name FROM My_Object__c LIMIT 1]; system.assertNotEquals(null, record.get('Name')); However, ...
10
votes
2answers
3k views

If it doesn't exist auto-create Organization level Custom Settings in my APEX code

We have created a hierarchy custom setting to store some data instead of hard-coding it into our managed package. Had I known that SF only auto-deploys the setting itself and NOT an Organization ...
9
votes
2answers
4k views

Checkbox on related list

Does anyone know how to add the checkbox column on related list in SF? I have a custom object that I'm try to get checkboxes for related list. Thanks
9
votes
2answers
1k views

Is encrypting passwords in protected custom settings a security requirement?

Regarding the Salesforce security review process, can anyone confirm (or deny) that storing a connection URL, username and password for a webservice utilized by an appexchange app can be done in plain ...
9
votes
1answer
17k views

Retrieve custom setting value - apex

I created a custom setting with two fields Active__c and Age__c. In my apex code, I want to retrieve one record from this custom setting where Name='Days'. This will return only one record. Would I ...
9
votes
1answer
2k views

Custom Setting is null in test method even though I set a value

I want to update the Opportunity stage depending on a status field on the account. I have a validation rule that makes a date field on the opportunity mandatory for some stages. This validation rule ...
9
votes
3answers
1k views

Generic SObject Getters Return Null for Boolean fields?

Question Am I taking crazy pills are is it unexpected behavior for the generic sObject getters to return null for boolean fields? Background Was troubleshooting a null pointer error and noticed ...
8
votes
4answers
5k views

Custom MetaData Types reference in Formula Field

I have a custom metadata type and a field in it with a value. I am creating a formula field on an object(TestObject) where I would like to reference a value from the above custom metadata type into ...
8
votes
2answers
7k views

Custom setting Setting type not visible

I am trying to create a new custom setting in salesforce but the Setting Type field is greyed out and fixed to Hierarchy. What could be the possible problem?
8
votes
1answer
4k views

Custom Settings - SOQL Limit

I am new to custom settings. My assumption is Custom Settings are part of application cache as such querying against custom settings do not count against SOQL limit. This is my code snippet (...
8
votes
1answer
2k views

Is that possible to change the custom setting “visibility” from protected to public once after it is created?

i have created a custom setting with visibility as protected. And now i want it to make the visibility to public. But when i edit the custom setting the visibility option is greyed out. How could i ...
8
votes
1answer
320 views

Using the Describe API, how can I tell whether a given Custom Setting is of list or hierarchy type?

I'm using Schema.getGlobalDescribe() to walk through the list of sObjects in the system. The DescribeSobjectResult offers isCustomSetting(), which allows me to tell which objects are custom settings. ...
7
votes
2answers
8k views

How do I access Custom Settings in Apex?

If I have a hierarchical custom setting: Custom_Page__c With one field: Url__c Using apex, how can I surface this field in a visualforce page? Can I just query it as if I was querying a custom ...
7
votes
1answer
1k views

Does custom setting count against the total number of custom objects available for your organization?

The Salesforce documentationhas below line Custom settings are a type of custom object. Each custom setting counts against the total number of custom objects available for your organization. I ...
7
votes
1answer
3k views

Custom Settings Limit: Cached data limit

Perhaps a silly question? In the Limits reference regarding custom settings we see "Custom Settings: Cached Data Limit" Where the limit is described as: The total amount of cached data allowed ...
7
votes
1answer
3k views

Can a trigger be attached to a Custom Setting?

I know triggers can be added to SObjects. Can the be added to Custom Settings as well? If so, then what would the apex look like?
7
votes
1answer
4k views

Can you do a SOQL Query on a Hierarchical Custom Setting?

I have a Hierarchical Custom Setting that I need to SOQL use a SOQL query for using the current User's Profile. Currently I'm using the getInstance() method with the User Profile ID to get the custom ...
7
votes
2answers
3k views

Visualforce: Displaying more than 20 records from a Custom Setting

I'm having issues with displaying more than 20 records from a Custom Setting on my visualforce page. I've tried using apex:repeat, apex:pageblocktable, apex:datatable with no luck. Best, Eric <...
7
votes
1answer
81 views

Pattern to abstract simple code to work on multiple records by using Custom Settings

Background: I want to add all users who are assigned a specific permission set to a specific chatter group. I have a simple version of this working, but would like to abstract this to use a list ...
6
votes
4answers
619 views

Alternatives to using page action for user preferences

Sometimes you have to load user preferences stored in a Hierarchy custom setting when a Visualforce page loads. If the preferences exist, then retrieve them, otherwise create them and insert them. ...
6
votes
1answer
2k views

upsert on Custom Setting

I've got a page that inserts/updates a custom setting record. I'm using upsert for this purpose but I've run into an error: There is already an item in this list with the name 005700000037xJaAAI ...
6
votes
1answer
3k views

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

I have to create a package XML for migrating two Custom Settings (say A,B) from one org to another. I have a sample for a Report Type but what should be the case for two Custom settings? <?xml ...
6
votes
3answers
5k views

Combine Custom settings with Custom Labels

Is there a way to combine custom settings with custom labels ? So that the output from a setting value would be a custom label ? To explain: In example, we have an international organisation, and ...
6
votes
2answers
375 views

App settings & static data

I need to store a few simple settings that describe the timing and behavior of an integration between Salesforce and a third party web app. In my former life, these things might have been stored in a ...
6
votes
1answer
778 views

Custom Settings are NO SObjects - How to use them polymorphic?

My app uses different types of custom settings. Let's call them SettingA__c and SettingC_c. I want a method that handles both types of settings polymorphically. private void handle(SObject setting) {...
6
votes
2answers
1k views

Custom Settings in Managed Package limits

So I have a use case where I will have many custom settings and each custom setting has many fields so easily getting in several MB of custom settings data. If I put this into a managed package where ...
6
votes
1answer
1k views

How to set a custom setting value in a managed package securely?

My application uses an authorization key stored in a protected custom setting to authenticate users to connect to an external web service. Since you can't define a default value on package install for ...
6
votes
1answer
157 views

How to fix two categories of UNABLE_TO_LOCK_ROW errors in Apex tests running in parallel?

I'm taking a look at running 300+ test classes in parallel again today. The main error - in about 5% of the test classes - was: UNABLE_TO_LOCK_ROW, unable to obtain exclusive access to this record ...
5
votes
3answers
514 views

Is the most common use case for custom settings lost in managed packages?

Background Public custom settings included as part of a managed package can be maintained by users of the target org if they have the Customize Application permission, which seems somewhat heavy ...
5
votes
2answers
9k views

Hierarchy Custom Setting .getInstance() Id

What's the best way to get the Id of the custom setting referenced in MyCustomSetting__c.getInstance() for a hierarchical custom setting? I'm trying to update your current instance of a custom ...
5
votes
2answers
14k views

What is difference between custom setting and custom object?

I familiar with custom object but what about custom setting?
5
votes
1answer
2k views

Eliminate query on Custom metadata type?

I'm trying to use Custom metadata type to replace a List type Custom settings. I have to access the Custom metadata type information in multipe apex classes and triggers. When I use custom settings, ...
5
votes
2answers
3k views

Activate and Deactivate trigger using Custom Setting

I have an Apex class called ShippingAddressTriggerHandler and Trigger called ShippingAddress on object Shipping. I want to create a custom setting called SwitchTrigger with checkbox Activate. ...
5
votes
2answers
10k views

Deploying custom setting using ant

I was looking at this doc : http://www.salesforce.com/us/developer/docs/daas/salesforce_migration_guide.pdf I am preparing a ant manifest for migration and cannot find custom setting in the doc, I ...
5
votes
2answers
2k views

Custom Settings - Visibility Protected - Managed Package

I have a requirement to create a protected (visibility) custom setting which will be part of managed released package, now in the next release we need to make the visibility to public. I know there ...