Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save codesnippet-in/1da3db03d0834d34dd4cba050e80e3f1 to your computer and use it in GitHub Desktop.
Save codesnippet-in/1da3db03d0834d34dd4cba050e80e3f1 to your computer and use it in GitHub Desktop.
salesforce UserInfo Methods example
VF Page:
<apex:page controller="con">
<apex:pageBlock >
<apex:pageBlockTable value="{!varuser}" var="item">
<apex:column value="{!item.name}"/>
<apex:column value="{!item.Email}"/>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:outputText value="{!test}"></apex:outputText>
</apex:page>
Controller Code:
public class con {
public String test { get; set; }
public List<contact> varuser { get; set; }
public string id1;
string id2=userinfo.getUserId();
user u=[select email from user where id=:id2];
public con(){
id1 = userinfo.getProfileId();
string str='Select Name,email from Contact where email='+'\''+u.email+'\'';
test=str;
varuser=Database.query(str);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment