+ Start a Discussion
Antonio_hotelbedsAntonio_hotelbeds 

Showing a section depending on a field

Hi all,

 

I have a section in my account visualforce page called Credit Info that should be shown only if the field Account Status equals "Credit". This field is also in the account object.

 

Otherwise it shouldnt be shown.

 

Could you tell me if this is possible and anyplace where I could find help to solve this issue?

 

Thanks,

 

Antonio

Best Answer chosen by Admin (Salesforce Developers) 
bob_buzzardbob_buzzard

You should be able to conditionally render the section in question based on the field value.

 

Most standard components have the rendered attribute, which can be set via a merge formula accessing the field.

 

Something like:

 

<apex:pageBlockSection rendered="{!account.Status__c=='Credit'}">

 ...

</apex:pageBlockSection>

 

All Answers

bob_buzzardbob_buzzard

You should be able to conditionally render the section in question based on the field value.

 

Most standard components have the rendered attribute, which can be set via a merge formula accessing the field.

 

Something like:

 

<apex:pageBlockSection rendered="{!account.Status__c=='Credit'}">

 ...

</apex:pageBlockSection>

 

This was selected as the best answer
Antonio_hotelbedsAntonio_hotelbeds

Thanks a lot!

 

I have to develop different interface depending on different conditions, for example depending on the record type and the user profile.

 

Is the use of rendered sections the best way to do it?

 

Thanks

bob_buzzardbob_buzzard

If they are completely different to each other, you might want to look at a page level action that sends the user to a particular page based on profile and record type.  You end up with more pages but it tends to be easier to understand.

Antonio_hotelbedsAntonio_hotelbeds

I would like to have a look at the explanation of the page level actions, could you refer me some documents where I could find info and examples about it?

 

thanks

bob_buzzardbob_buzzard

The following cookbook article makes use of the action attribute, and directs the user to particular pages based on profile.  You should be able to adapt that if you need to:

 

http://developer.force.com/cookbook/recipe/overriding-a-page-for-some-but-not-all-users

Antonio_hotelbedsAntonio_hotelbeds

Thanks a lot!!