function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
KazminKazmin 

Initializing Custom Settings

Hey everyone,

I'm relatively new to apex and I'm missing something about Custom Settings. What I want to do is store some organization wide configuration and allow any particular user to change that configuration for himself. It seems that Custom Settings are the way to go for that task. 

What I cannot find out is how to initialize the custom settings with the organization wide defaults after the package is deployed somewhere. Is there something like "after deploy trigger" or any other way to proceed?

Thanks a lot for the help.,

Nikolay

bob_buzzardbob_buzzard

As of summer 12 you can specify an apex that is run after install/upgrade of the package - this can default the data you need.

 

https://help.salesforce.com/apex/HTViewHelpDoc?id=apex_post_install_script.htm&language=en_US

Tejpal KumawatTejpal Kumawat

Hi,

 

You should go custom setting :--

 

System Overview -> Develop ->custom setting 

 

 

 

And you should Initilize in Apex Code as :

 

custom_setting_API_name appConfig = custom_setting_API_name.getInstance();

 

 

And for detetails go through Link :---

http://www.salesforce.com/us/developer/docs/apexcode/Content/apex_methods_system_custom_settings.htm

 

 

If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.

 

Thanks