Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

So in my rendered attribute I am calling a getter method that returns a boolean. However I want to set rendered to the opposite of what it returns because it is used to render one component or another. What is the correct syntax for doing this?

I am aware that I can do this:

rendered="{!IF(selectedNameIsContact == false, true, false)}"

But I was hoping for a cleaner syntax such as

rendered="NOT{!selectedNameIsContact}"
share|improve this question
add comment

1 Answer 1

up vote 4 down vote accepted

You just need to use double '!!'. It looks funky, but it accomplishes what you are looking for

rendered="{!!selectedNameIsContact}"

EDIT

As pointed out by @sfdcfox, you could also use

rendered="{!not selectedNameIsContact}"

Also pointed out by @Ralph, you could also use

{!selectNameisContact == false}
share|improve this answer
    
Excellent! Thank you –  Louis Pujol Jul 1 at 19:24
2  
Also, rendered="{!not selectedNameIsContact}". I'd avoid using !! directly, because it might be construed as a typo later. –  sfdcfox Jul 1 at 19:24
    
Good point @sfdcfox. Added to reflect. –  sfdc_ninja Jul 1 at 19:25
    
The not does look a lot better than the double exclamation. Thanks for the input –  Louis Pujol Jul 1 at 19:38
2  
where is {!not someBooleanFieldOrProperty} documented? I would have done this as {!NOT(someBooleanFieldOrProperty)} –  crop1645 Jul 1 at 20:04
show 1 more comment

Your Answer

 
discard

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.