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
shrey.tyagi88@tcs.comshrey.tyagi88@tcs.com 

button on visualforce page logic-Please help!!

Hi All,

      I have this apex:button on visualforce page that I want to render ob the basis of outcome of two conditions .

render =A AND (Not (B)).

A condtion is = {!Opportunity.Checkbox==False}

B condtion is="{!$ObjectType.Opportunity.updateable}"

rendered="{(!Opportunity.Checkbox==False) && !(!$ObjectType.Opportunity.updateable)}" is not working as expected

i AM UNABLE TO GET THE RIGHT SYNTAX HERE, can anyone please help me!!!!

Best Answer chosen by Admin (Salesforce Developers) 
Shailesh DeshpandeShailesh Deshpande
Is the opportunity.checkbox a boolean field? Assuming it is a booleab fields I would suggest you to try the below:

rendered="{!(NOT(opportunity.checkbox) && (NOT($object. Opportunity.isUpdateable))}"

and if your checkbox field is a text field containing the value as false, then you'd need to include quotes:

rendered="{!((opportunity.checkbox == 'False' ) && NOT($object.opportunity.isupdateable))}"

Also make sure the cases. FALSE will not be equal to False or false

All Answers

prady-cmprady-cm

wouldnt this work

 

endered="{(!Opportunity.Checkbox==False) && (!$ObjectType.Opportunity.updateable==false)}"

 

Shailesh DeshpandeShailesh Deshpande
Is the opportunity.checkbox a boolean field? Assuming it is a booleab fields I would suggest you to try the below:

rendered="{!(NOT(opportunity.checkbox) && (NOT($object. Opportunity.isUpdateable))}"

and if your checkbox field is a text field containing the value as false, then you'd need to include quotes:

rendered="{!((opportunity.checkbox == 'False' ) && NOT($object.opportunity.isupdateable))}"

Also make sure the cases. FALSE will not be equal to False or false
This was selected as the best answer
themattythematty
Shailesh is right, you only have to use the exclamation once (and at the start) in a brace.
shrey.tyagi88@tcs.comshrey.tyagi88@tcs.com

Thanks a lot Shailesh for your reply, I used your solution and it worked. The reason I faced this issue is because i got confused over use of "!" in rendered tag as a getter and as a NOT symbol. If its not too much trouble for you , could you please explain the cause and effect of using "! " in rendered tag?