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
streetstreet 

Custom Setting

I have created a Custom Setting (Hierarchy Type), With 3 fields in it.

 

 

Now, how can i display these values on Visual force page.

 

i have tried this, but unable to display values on VF page.

Weekly_Invoice_Setting__c (Custom Setting Name)

Below my 3 fields

1. Nominal_Code__c

2.Sales_Invoice__c

3.TI_VAT_code__c 

 

public Weekly_Invoice_Setting__c WIS {get; set;}

 Weekly_Invoice_Setting__c WIS = [select Nominal_Code__c,Sales_Invoice__c,TI_VAT_code__c from Weekly_Invoice_Setting__c];

Best Answer chosen by Admin (Salesforce Developers) 
Navatar_DbSupNavatar_DbSup

Hi,


Try the below code as reference for custom setting example:


///////////////// VF Page ///////////////////
<apex:page controller="CustomSetting" >
<apex:pageBlock id="p">
<apex:outputPanel id="o">
<apex:pageBlockTable value="{!w}" var="l">
<apex:column >
<apex:outputlabel value="{!l.UserName__c}"/>
</apex:column>

<apex:column >
<apex:outputlabel value="{!l.Password__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>

</apex:pageBlock>
</apex:page>
/////////////////////////// Controller ////////////////////////////
public class CustomSetting
{
public list<WeeklyInvoiceSetting__c> w{get;set;}
public CustomSetting ()
{
w=[select id,password__c,username__c from WeeklyInvoiceSetting__c];
}

}

 

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

All Answers

Navatar_DbSupNavatar_DbSup

Hi,


Try the below code as reference for custom setting example:


///////////////// VF Page ///////////////////
<apex:page controller="CustomSetting" >
<apex:pageBlock id="p">
<apex:outputPanel id="o">
<apex:pageBlockTable value="{!w}" var="l">
<apex:column >
<apex:outputlabel value="{!l.UserName__c}"/>
</apex:column>

<apex:column >
<apex:outputlabel value="{!l.Password__c}"/>
</apex:column>
</apex:pageBlockTable>
</apex:outputPanel>

</apex:pageBlock>
</apex:page>
/////////////////////////// Controller ////////////////////////////
public class CustomSetting
{
public list<WeeklyInvoiceSetting__c> w{get;set;}
public CustomSetting ()
{
w=[select id,password__c,username__c from WeeklyInvoiceSetting__c];
}

}

 

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

This was selected as the best answer
streetstreet

I have placed the query in a method call, so that was not displaying. Now placed the query in constructor its wrkg.

 

 

Dont know the difference.

 

But It helped me.

Thanks Jain

Devendra@SFDCDevendra@SFDC

 

Hi street,

 

When your page gets loaded, constructor gets invoked which results in your query gets executed through constructor and result is displayed on User Interface.

 

Hope this helps.

 

Thanks,

Devendra