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
SFD SalesforceSFD Salesforce 

User Admin name else if Login

 

 

 

Hi  SFDL,

 

my code: 
 
public class login
{
public String currentUserProf { get; set; }
public String profilename { get; set; }
String name='System Administrator';

public String isAdmin()


{
return null;
}
String profileId= UserInfo.getProfileId();
boolean isAdmin=false;
Profile currentUserProf= [select name from Profile where id =:profileId limit 1];

if(currentUserProf==NULL)
{
isAdmin=false;
else
isAdmin=true;
if(currentUserProf.name.equalsIgnoreCase('System Administrator'))
System.debug('System Administrator');
else
if(currentUserProf.name.equalsIgnoreCase('RSL gold partner user'))
System.debug('RSL gold partner user');
else
if(currentUserProf.name.equalsIgnoreCase('RSL gold partner manager user'))
{
System.debug'(RSL gold partner manager user');


}
 }
}
my vf page:
 
<apex:page controller="login">
<apex:outputLabel value="U R Admin" rendered="{isAdmin()}"/>
<apex:outputLabel value="U RませAdmin" rendered="{NOTIsAdmin()}"/> </頂点:ページ>

 

 

.How to write the  parameter  passing in this method of apex class (like IsProfile(String profilename))..it displays profile User name details like ('System Adminstrator of debug console)  .By using if else condition.

 

 

Thanks

Pradeep

 

samreet_matharu@psl.co.insamreet_matharu@psl.co.in

You can directly make use of global variable {!$Profile.Name} in the rendered attribute directly on the page..As,

<apex:outputLabel value="Admin" rendered="{!IF($Profile.Name=='System Administrator')}"/>