Monday, November 26, 2012

Viewing and Editing all Custom Settings in Visualforce Page


To see or edit custom setting records, we navigate to each custom setting, click on manage button and edit/ view custom settings records.

In order to avoid this navigation for all custom setting, I thought of creating a VF page where we can select custom setting present in organization and view/ edit records related to the selected custom settings on the same VF Page.

In order to achieve this, I have created a VF page named as "Sunil_CSDetails". Also I have created a batch class which will check for custom settings present in organization and will store their API names in one custom object (say "CS_Name__c"). You can use standard name field or custom text field (say "Name__c") to store API name of custom object.


User will click on Refresh button in order to fetch all custom settings present in the organization. After clicking on Refresh button, user will see progress bar with status. When the operation is finished, a new button will appear on the page with a message to click on that button.


After clicking on "Display Options" button, the page will display a picklist with all available custom settings and records related to selected option.
Now you can select any custom settings present in organization and view related records. Click on "Edit" button in order to edit any custom settings records.

You can download zip file from the link below which contains apex classes, VF page and custom objects.

Download Apex class and VF Page code from here

Looking forward to your comments and views.





Refer Below Links for Salesforce Interview Questions

8 comments:

  1. Nice effort Sunil. Will take a look. You can do it through data loader though!!

    ReplyDelete
  2. This looks like a useful example thanks Sunil, but the download is hanging when I try to access it...

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. This comment has been removed by the author.

    ReplyDelete
  5. Hi Sunil,

    We can fetch records directly from custom settings, please let me know why we need to create new custom object to store the API names.

    Also I want to add new record...how can i overcome this.

    Thanks in Advance,
    Kumar

    ReplyDelete
  6. This comment has been removed by the author.

    ReplyDelete
  7. All the things in the blog are conveyed so elegantly.
    Resumeyard

    ReplyDelete
  8. Remaining on theme in light of your unique substance design brings down the possibility of you editting vigorously on account of a great deal of insignificant or mistaken substance sneaking into your first draft.
    Postscrib.com

    ReplyDelete