Wolffel

VisualForceExercises

May 7th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 4.25 KB | None | 0 0
  1. /*********************************************************************************************/
  2.  
  3. <apex:page standardController="Contact">
  4.     <apex:form >
  5.     <apex:pageBlock title="Add contacts">
  6.          <apex:pageBlockSection columns="1">
  7.             <apex:inputField value="{! Contact.FirstName }"/>    
  8.                 <apex:inputField value="{! Contact.Lastname }"/>      
  9.     <apex:inputField value="{! Contact.email }"/>      
  10.             </apex:pageBlockSection>
  11.        
  12.         <apex:pageBlockButtons >
  13.             <apex:commandButton action="{! save }" value="Save" />        
  14.         </apex:pageBlockButtons>
  15.         </apex:pageBlock>
  16.     </apex:form>
  17. </apex:page>
  18. /*********************************************************************************************/
  19.  
  20. <apex:page standardController="Opportunity" >
  21.   <apex:pageBlock >
  22.     <apex:pageBlockSection >
  23.        <apex:outputField value="{!Opportunity.Name}" />
  24.         <apex:outputField value="{!Opportunity.Amount}" />
  25.          <apex:outputField value="{!Opportunity.CloseDate}" />
  26.           <apex:outputField value="{!Opportunity.Account.Name}" />
  27.   </apex:pageBlockSection>
  28.   </apex:pageBlock>
  29.  
  30. </apex:page>
  31. /*********************************************************************************************/
  32.  
  33. <apex:page standardController="Contact">
  34.   <apex:pageBlock title="Contact Summary">
  35.         <apex:pageBlockSection >
  36.             First Name: {! Contact.FirstName } <br/>
  37.             Last Name: {! Contact.LastName } <br/>
  38.             Owners Email: {! Contact.Owner.Email } <br/>
  39.         </apex:pageBlockSection>
  40.     </apex:pageBlock>
  41. </apex:page>
  42. /*********************************************************************************************/
  43.  
  44. <apex:page >
  45.  
  46.     <p>The year today is {! YEAR(TODAY()) }</p>
  47.     <p>Tomorrow will be day number  {! DAY(TODAY() + 1) }</p>
  48.     <p>Lets find a maximum: {! MAX(1,2,3,4,5,6,5,4,3,2,1) } </p>
  49.     <p>The square root of 49 is {! SQRT(49) }</p>
  50.     <p>Is it true?  {! CONTAINS('salesforce.com', 'force.com') }</p>
  51.    
  52.     <p>{! IF( CONTAINS('salesforce.com','force.com'),
  53.      'Yep', 'Nope') }</p>
  54.     <p>{! IF( DAY(TODAY()) < 15,
  55.      'Before the 15th', 'The 15th or after') }</p>
  56.      
  57.          <apex:pageBlock title="User Status">
  58.          <apex:pageBlockSection columns="1">
  59.            
  60.             {!$User.FirstName} {!$User.LastName} ({!$User.Username})
  61.  
  62.            
  63.           </apex:pageBlockSection>
  64.           </apex:pageBlock>
  65.      
  66.  
  67. </apex:page>
  68. /*********************************************************************************************/
  69.  
  70. <apex:page showHeader="false">
  71. <apex:image id="theImage" value="https://developer.salesforce.com/files/salesforce-developer-network-logo.png" width="220" height="55"/>
  72.  
  73. </apex:page>
  74.              
  75. /*********************************************************************************************/
  76.  
  77. <apex:page controller="NewCaseListController">
  78.  
  79.         <apex:pageBlock title="New Case List" id="cases_list">
  80.            
  81.         <apex:repeat var="case" value="{!NewCases}">
  82.        
  83.         <apex:outputLink value="/{! case.id}">
  84.         ID:  {! case.id }
  85.         </apex:outputLink><br/>
  86.         <apex:outputLink value="/{! case.id}">
  87.         Case Number:  {! case.CaseNumber }
  88.         </apex:outputLink><br/>    
  89.    
  90.     </apex:repeat>
  91. </apex:pageBlock>
  92. </apex:page>
  93.                
  94. /*********************************************************************************************/
  95.  
  96. //Need to upload an image on static reference in salesforce
  97. <apex:page showHeader="false">
  98.  
  99. <apex:image url="{!URLFOR($Resource.vfimagetest, 'cats/kitten1.jpg')}" />
  100.  
  101. </apex:page>
  102. /*********************************************************************************************/
  103.  
  104. <apex:page standardController="Account" recordSetVar="Accounts" >
  105.     <apex:pageblock >
  106.         <apex:repeat var="a" value="{!Accounts}" rendered="true"  id="account_list">
  107.             <li>
  108.                 <apex:outputLink value="/{!a.ID}" >
  109.                     <apex:outputText value="{!a.Name}"/>
  110.                 </apex:outputLink>
  111.             </li>
  112.         </apex:repeat>
  113.     </apex:pageblock>
  114. </apex:page>
  115. /*********************************************************************************************/
Add Comment
Please, Sign In to add comment