Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want something like the below in my test to see of a outputPanel should be rendered

<apex:outputpanel rendered="{!recordType == 'System Change Request' & $currentPage().getParameters().get('mode') =='edit'}"> 

so if the recordType variable of the custom controller is 'System Change Request' and the mode of the page is set to edit then render the panel...

Unfortunately I must be getting it wrong as I am getting a syntax error

Syntax error. Extra '.'

The reason I am trying to do this, is so that I can combine my View and edit pages in one VF Page, and just re-render the main panel when the user chooses to edit an existing record...

Or should I be using a variable in the controller that is set from the page parameters?

share|improve this question
you should use variable in controller to set page parameter – sfdc Feb 2 at 21:33
Try $CurrentPage.parameters.mode for the syntax error... – sam_s Feb 2 at 21:40
up vote 4 down vote accepted

If you want to use logical operators, and is &&, or is ||. Note that the character occurs twice. However, it is probably cleaner in VF to use the AND and OR functions (e.g. AND(condition1, condition2) instead of condition1 && condition2. I mention this specifically because negation can look pretty awkward, compare {!NOT(condition)} with {!!condition}. The latter is far more confusing for me to read.

As mentioned in the comments, you are also incorrectly referencing page parameters, you should instead use $CurrentPage.Parameters.mode or cache it in Apex for simplicity.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.