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
udaykalyank1.3923045490576467E12udaykalyank1.3923045490576467E12 

Custom Settings

Hi All,

Can we insert values from VF page to Customsettings? 

If anybody has done it Plz..reply ASAP...

Thanks in Advance...
Subramani_SFDCSubramani_SFDC
Here is the code.....

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


MARK it as Best Answer if it solves ur problem


Regards,
Subramani
Trinay technology solutions
SFDC_DevloperSFDC_Devloper
Hi Uday...
go  to Setup-->Develop-->Custom Setting-->click on Manage--->if data is available click on Delete Button  (or) no data means then leave it....try belo w example...Its working fine  here my custom settting :

User-added image

<pre>
<apex:page controller="customSetting">
<apex:form >
    <apex:pageblock title="Content Of Custom Setting ">
        <apex:pageBlockSection >
            <apex:panelGrid columns="2">
                Name :
                <apex:inputText value="{!Name}"/>
                Phone :
                <apex:inputText value="{!Phone}"/>
            </apex:panelGrid>           
        </apex:pageBlockSection>
        <apex:commandButton value="Save" action="{!sav}"/>
    </apex:pageblock>
</apex:form>
</apex:page>
</pre>
-----------------------------------------------
<pre>
public class customSetting { 
    public String Name{get;set;}
    public String loc{get;set;}
    public Integer Phone {get;set;}
    Id memId;
    public List<HirachicalCst__c> hcsList {get;set;}
    public customSetting () {
       
    }
    public void sav() {
        HirachicalCst__c hcstn= new HirachicalCst__c();
        hcstn.Id=memId;
        hcstn.Name__c = Name;
        hcstn.Phone__c = Phone;
        insert hcstn;
    }          
}
</pre>
----------------------------------------------
Output:

User-added image

Thanks,
Rockzz