Created
December 8, 2016 14:30
-
-
Save codesnippet-in/1da3db03d0834d34dd4cba050e80e3f1 to your computer and use it in GitHub Desktop.
salesforce UserInfo Methods example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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