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
SalesForce DummySalesForce Dummy 

Visualforce syntax error. Help!!

'm trying to hide a command buttong if a user is not a System Administrator but I'm getting a syntax error. The command button worked until I put in the rendered atrribute. Can anyone find the syntax error?


 

<
apex:commandButton
value="View Expanded"
action="{!toggleForecastExpanded}"
rendered="{!IF({!$User.ProfileId}== '00eU0000000qqCOIAY', false, true)}"
/>

Thanks for your help.

S91084S91084

Try This:

 

<apex:commandButton value="View Expanded" action="{!toggleForecastExpanded}" rendered="{!IF($User.ProfileId== '00eU0000000qqCOIAY', false, true)}"/>

 

You need not embed the $User.ProfileId in {! } again in the IF loop.

Naidu PothiniNaidu Pothini
<apex:commandButton value="View Expanded" action="{!toggleForecastExpanded}" rendered="{!If($Profile.Name == 'System Administrator',FALSE,TRUE)}"/>

 

Hard coding Id is not a best idea. 

 

{$Profile.Name} will return the current users profile.

S91084S91084

I guess he is trying to get the profile of the logged in user. to do so that name or id must come from the apex as $User.Profile.Name is not supported.