Cloud Entwicklung       mit Apex
Apex?Apex Code extends the powerful and proven success of the Force.com platform byintroducing the ability to write code t...
MVC
Use Case Beschwerde ManagmentAnforderung: Konversationen sollen auf der Case-Seite möglichstschnell editierbar sein.
GUI PrototypeDie "Conversation Page"
Views & ControllerAufruf einer Visualforce Page über:( https://emea.salesforce.com/apex/yourpage )<apex:page controller="T...
Controller ExtensionsFür eine bessere Integration in SalesForce!( https://emea.salesforce.com/5002000000MVOBr )<apex:page ...
Controller ExtensionsFür eine bessere Integration in SalesForce!( https://emea.salesforce.com/5002000000MVOBr )<apex:page ...
Add new ConversationWas brauchen wir?                        Formular für neues                        Conversation-Object...
Add new ConversationController Extension  public class ConversationController {      public ConversationController(ApexPag...
The Apex Tag-Library<apex:form id="conversation_form"><apex:pageblock>     <apex:pageblocksection columns="1">     <apex:p...
The Action-Functionpublic class ConversationController {  ......     /**     * Our ActionFunction to add a new Conversatio...
Conversation Listpublic class ConversationController {......      public List<Conversation__c> conversations{         publ...
Conversation List<apex:pageblock id="conversation" title="Conversation Log">    <apex:pageblocksection >     <apex:pageblo...
Conversation List.....     </apex:dataTable>      </apex:pageblockSectionItem>      <apex:pageblockSectionItem >        <a...
Select a Conversationpublic class ConversationController {.......    public String selectConversationID{ get; set; }    pu...
Select a Conversation <apex:actionfunction action="{!selectConversation}" rerender="conversationdetail">     <apex:param n...
Upcoming SlideShare
Loading in …5
×

Cloud Entwicklung mit Apex

532 views

Published on

Vortrag von Moritz Thielcke, code mitte GmbH, beim code force Meet-up vom 11. Juni 2012.

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
532
On SlideShare
0
From Embeds
0
Number of Embeds
5
Actions
Shares
0
Downloads
3
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Cloud Entwicklung mit Apex

  1. 1. Cloud Entwicklung mit Apex
  2. 2. Apex?Apex Code extends the powerful and proven success of the Force.com platform byintroducing the ability to write code that runs on salesforce.com servers.
  3. 3. MVC
  4. 4. Use Case Beschwerde ManagmentAnforderung: Konversationen sollen auf der Case-Seite möglichstschnell editierbar sein.
  5. 5. GUI PrototypeDie "Conversation Page"
  6. 6. Views & ControllerAufruf einer Visualforce Page über:( https://emea.salesforce.com/apex/yourpage )<apex:page controller="TestController"> Hallo {!name}</apex:page>Class TestController{ public String name { get; set; }public TestController{ this.name = UserInfo.getName(); }}
  7. 7. Controller ExtensionsFür eine bessere Integration in SalesForce!( https://emea.salesforce.com/5002000000MVOBr )<apex:page standardController="Case" extensions="CaseControllerTest">Hallo {!caseID} !</apex:page>
  8. 8. Controller ExtensionsFür eine bessere Integration in SalesForce!( https://emea.salesforce.com/5002000000MVOBr )<apex:page standardController="Case" extensions="CaseControllerTest">Hallo {!caseID} !</apex:page>Class TestController{ public String caseID { get; set; } public TestController(ApexPages.StandardController controller){ if(controller != null){ caseID = controller.getId(); } }}
  9. 9. Add new ConversationWas brauchen wir? Formular für neues Conversation-Object. Save-Funktion
  10. 10. Add new ConversationController Extension public class ConversationController { public ConversationController(ApexPages.StandardController controller){ if(controller != null){ caseID = controller.getId(); } } public Conversation__c conversation{ public get{ if(conversation==null){ conversation = new Conversation__c( Case__c = caseID ); } return conversation; } private set; } }
  11. 11. The Apex Tag-Library<apex:form id="conversation_form"><apex:pageblock> <apex:pageblocksection columns="1"> <apex:pageblockSectionItem > {!$ObjectType.Conversation__c.Fields.Name.label} <apex:inputfield value="{!conversation.Name}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > {!$ObjectType.Conversation__c.Fields.Type__c.label} <apex:inputfield value="{!conversation.Type__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > {!$ObjectType.Conversation__c.Fields.Note__c.label} <apex:inputfield value="{!conversation.Note__c}"/> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:commandButton action="{!addConversation}" value="Add Conversation" rerender="conversation_form"/> </apex:pageblockSectionItem></apex:pageblocksection></apex:pageblock></apex:form>
  12. 12. The Action-Functionpublic class ConversationController { ...... /** * Our ActionFunction to add a new Conversation to the Log: */ public PageReference addConversation(){ /* save conversation */ insert(this.conversation); /* create a new one */ conversation = new Conversation__c( Case__c = caseID ); return null; } ......}
  13. 13. Conversation Listpublic class ConversationController {...... public List<Conversation__c> conversations{ public get{ if(conversations==null){ conversations = getConverationsForCase(this.caseID); } return conversations; } private set; }... public List <Conversation__c> getConverationsForCase(Id caseID){ return [Select c.Type__c, c.SystemModstamp, c.Note__c, c.Name, c.LastModifiedDate, c.LastModifiedById, c.IsDeleted, c.Id, c.CreatedDate, c.CreatedById, c.Case__c From Conversation__c c where c.Case__c = :caseID order by c.CreatedDate desc]; }}
  14. 14. Conversation List<apex:pageblock id="conversation" title="Conversation Log"> <apex:pageblocksection > <apex:pageblockSectionItem id="coversation_table"> <apex:dataTable value="{!conversations}" var="conv"> <apex:column onclick="selectConversation({!conv.id});"> <apex:facet name="header">{!$ObjectType.Conversation__c.fields.Name.label} </apex:facet> <apex:outputField styleClass="taskdate" value="{!conv.Name}"/> </apex:column>.....
  15. 15. Conversation List..... </apex:dataTable> </apex:pageblockSectionItem> <apex:pageblockSectionItem > <apex:pageblock id="conversationdetail"> <p>{!selectedConversation.Note__c}</p> </apex:pageblock> </apex:pageblockSectionItem> </apex:pageblocksection> </apex:pageblock> </apex:form>
  16. 16. Select a Conversationpublic class ConversationController {....... public String selectConversationID{ get; set; } public Conversation__c selectedConversation{ public get; private set; } public PageReference selectConversation(){ if( selectConversationID != null ){ /* find the conversation */ for(Conversation__c c : this.conversations ){ if( c.id == (Id)selectConversationID ){ this.selectedConversation = c; return null; } } } return null; }.....
  17. 17. Select a Conversation <apex:actionfunction action="{!selectConversation}" rerender="conversationdetail"> <apex:param name="selectConversationID" assignTo="{!selectConversationID}" /> </apex:actionfunction>.... <apex:pageblock id="conversation" title="Conversation Log"> <apex:pageblocksection > <apex:pageblockSectionItem id="coversation_table"> <apex:dataTable value="{!conversations}" var="conv" title="Conversations"> <apex:column onclick="selectConversation({!conv.id});">.... <apex:pageblockSectionItem > <apex:pageblock id="conversationdetail"> <p>{!selectedConversation.Note__c}</p> </apex:pageblock> </apex:pageblockSectionItem> </apex:pageblocksection>

×