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
nello_THnello_TH 

Custom setting in visualforce

We wish to reference a custom setting field in a visualforce page, as follows:

 

<iframe src="{!$Setup.OurNS__Our_Custom_Setting__c.URL__c}" style="width:100%; height:800px; padding: 0;" frameborder="0"></iframe>

This custom setting type is Hierarchy and contains default organization level values only.

The problem is that no data is being retrieved from the custom setting field.... Is it possible to reference a field in a custom setting within a visualforce page in this way?

Navatar_DbSupNavatar_DbSup

Hi,

 

No, you cannot do this because you can only access hierarchy custom settings in formula field and validation rules.

 

Here is the generic syntax:

 

{!$Setup.CustomSettingName__c.CustomFieldName__c}

 

If you want Custom settings value in visualforce page then you can take reference this code snippet 

<apex:page standardController="CSO__c" recordSetVar="CSObj">

<apex:pageBlock >

<apex:pageBlockTable value="{!CSObj}" var="a">

<apex:column value="{!a.yes__c}" title="Val"/>

</apex:pageBlockTable>

</apex:pageBlock>

</apex:page>

For more detail follow the below link:

http://blog.jeffdouglas.com/2010/02/08/using-hierarchy-custom-settings-in-salesforce-com/

 

Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved.