Activity Forums Salesforce® Discussions How can we use Custom Setting in Salesforce to store information?

  • Nikita

    Member
    November 4, 2019 at 5:51 am

    Hi Prachi,

    To store information in Custom Seting you have to create or edit a custom setting.Ue steps as following

    1. From Setup, enter Custom Settings in the Quick Find box, then select Custom Settings.
    2. Click New to create a new custom setting, click Edit next to the name of a custom setting, or click Edit while viewing the details of a custom setting.
    3. Define the following:
      • Label—Enter the label displayed in the application.
      • Object Name—Enter the name to be used when the custom setting is referenced by formula fields, validation rules, Apex, or the SOAP API.
      • Setting Type—Select a type of List or Hierarchy. The List type defines application-level data, such as country codes or state abbreviations. The Hierarchy type defines personalization settings, such as default field values, that can be overridden at lower levels in the hierarchy.
      • Visibility—Select a visibility of Protected or Public.
        • Protected—If the custom setting is contained in a managed package, subscribing organizations can't see the custom setting: it doesn't display as part of the package list. In addition, subscribing organizations can't access the custom setting using either Apex or the API. Custom settings can only be accessed by the Apex code that is part of the managed package. If the custom setting is contained in an unmanaged package, the custom setting is available through the Enterprise WSDL like any custom object (as if the Visibility was Public.)
        • Public—The custom setting is available through the Enterprise WSDL like any custom object. You can package custom settings defined as public. The subscribing organizations can edit the values, as well as access them using Apex and the API, regardless of the type of package (either managed or unmanaged).
    4. Enter an optional description of the custom setting. A meaningful description will help you remember the differences between your custom settings when you’re viewing them in a list.
    5. Click Save.

    After that you can see that the settings is like an object, having a new button for custom fields. You can create as many custom fields as you want and store data in them.

    After creating custom fields you can access this from APEX code too. Simply fire a SOQL Query in APEX and use the name of the setting you created in the place of an object name.Also You can add this field in other custom formula fields, directly by selecting the field name in insert field. You can also create records in this object with the help of APEX code.
     

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos