SlideShare una empresa de Scribd logo
1 de 17
Descargar para leer sin conexión
Cloud Entwicklung
       mit Apex
Apex?
Apex Code extends the powerful and proven success of the Force.com platform by
introducing the ability to write code that runs on salesforce.com servers.
MVC
Use Case
 Beschwerde Managment




Anforderung: Konversationen sollen auf der Case-Seite möglichst
schnell editierbar sein.
GUI Prototype
Die "Conversation Page"
Views & Controller
Aufruf 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();
    }
}
Controller Extensions
Für eine bessere Integration in SalesForce!
( https://emea.salesforce.com/5002000000MVOBr )

<apex:page standardController="Case" extensions="CaseControllerTest">
Hallo {!caseID} !
</apex:page>
Controller Extensions
Fü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();
           }
     }
}
Add new Conversation
Was brauchen wir?




                        Formular für neues
                        Conversation-Object.




                    Save-Funktion
Add new Conversation
Controller 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;
      }

  }
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>
The Action-Function
public 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;
     }

    ......
}
Conversation List
public 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];
      }

}
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>
.....
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>
Select a Conversation
public 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;
    }

.....
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>

Más contenido relacionado

La actualidad más candente

Frameworks da nova Era PHP FuelPHP
Frameworks da nova Era PHP FuelPHPFrameworks da nova Era PHP FuelPHP
Frameworks da nova Era PHP FuelPHP
Dan Jesus
 
Gravity Forms Hooks & Filters
Gravity Forms Hooks & FiltersGravity Forms Hooks & Filters
Gravity Forms Hooks & Filters
iamdangavin
 
sfDay Cologne - Sonata Admin Bundle
sfDay Cologne - Sonata Admin BundlesfDay Cologne - Sonata Admin Bundle
sfDay Cologne - Sonata Admin Bundle
th0masr
 

La actualidad más candente (20)

Zero to SOLID
Zero to SOLIDZero to SOLID
Zero to SOLID
 
Template syntax in Angular 2.0
Template syntax in Angular 2.0Template syntax in Angular 2.0
Template syntax in Angular 2.0
 
2013-06-25 - HTML5 & JavaScript Security
2013-06-25 - HTML5 & JavaScript Security2013-06-25 - HTML5 & JavaScript Security
2013-06-25 - HTML5 & JavaScript Security
 
Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)Apostrophe (improved Paris edition)
Apostrophe (improved Paris edition)
 
Manipulating Magento - Meet Magento Netherlands 2018
Manipulating Magento - Meet Magento Netherlands 2018Manipulating Magento - Meet Magento Netherlands 2018
Manipulating Magento - Meet Magento Netherlands 2018
 
Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8Unit testing after Zend Framework 1.8
Unit testing after Zend Framework 1.8
 
Building Data Rich Interfaces with JavaFX
Building Data Rich Interfaces with JavaFXBuilding Data Rich Interfaces with JavaFX
Building Data Rich Interfaces with JavaFX
 
RichFaces: more concepts and features
RichFaces: more concepts and featuresRichFaces: more concepts and features
RichFaces: more concepts and features
 
Php Unit With Zend Framework Zendcon09
Php Unit With Zend Framework   Zendcon09Php Unit With Zend Framework   Zendcon09
Php Unit With Zend Framework Zendcon09
 
Frameworks da nova Era PHP FuelPHP
Frameworks da nova Era PHP FuelPHPFrameworks da nova Era PHP FuelPHP
Frameworks da nova Era PHP FuelPHP
 
Synapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephpSynapseindia reviews sharing intro cakephp
Synapseindia reviews sharing intro cakephp
 
Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )Paypal REST api ( Japanese version )
Paypal REST api ( Japanese version )
 
MVC.net training in pune
MVC.net training in pune MVC.net training in pune
MVC.net training in pune
 
Gravity Forms Hooks & Filters
Gravity Forms Hooks & FiltersGravity Forms Hooks & Filters
Gravity Forms Hooks & Filters
 
QA for PHP projects
QA for PHP projectsQA for PHP projects
QA for PHP projects
 
Storytelling By Numbers
Storytelling By NumbersStorytelling By Numbers
Storytelling By Numbers
 
Angular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.xAngular 1.x vs. Angular 2.x
Angular 1.x vs. Angular 2.x
 
Consuming Web Services with Swift and Rx
Consuming Web Services with Swift and RxConsuming Web Services with Swift and Rx
Consuming Web Services with Swift and Rx
 
Session1+2
Session1+2Session1+2
Session1+2
 
sfDay Cologne - Sonata Admin Bundle
sfDay Cologne - Sonata Admin BundlesfDay Cologne - Sonata Admin Bundle
sfDay Cologne - Sonata Admin Bundle
 

Destacado

Introduction Force.com-Platform / Salesforce.com
Introduction Force.com-Platform / Salesforce.comIntroduction Force.com-Platform / Salesforce.com
Introduction Force.com-Platform / Salesforce.com
Aptly GmbH
 

Destacado (13)

Introduction to Force.com
Introduction to Force.comIntroduction to Force.com
Introduction to Force.com
 
Connected Products
Connected ProductsConnected Products
Connected Products
 
Introduction to Force.com Webinar
Introduction to Force.com WebinarIntroduction to Force.com Webinar
Introduction to Force.com Webinar
 
Introduction Force.com-Platform / Salesforce.com
Introduction Force.com-Platform / Salesforce.comIntroduction Force.com-Platform / Salesforce.com
Introduction Force.com-Platform / Salesforce.com
 
Salesforce1 Platform
Salesforce1 PlatformSalesforce1 Platform
Salesforce1 Platform
 
Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)Artem Zhurbila - docker clusters (solit 2015)
Artem Zhurbila - docker clusters (solit 2015)
 
Introducing the Salesforce platform
Introducing the Salesforce platformIntroducing the Salesforce platform
Introducing the Salesforce platform
 
Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3Secure Development on the Salesforce Platform - Part 3
Secure Development on the Salesforce Platform - Part 3
 
How Salesforce CRM works & who should use it?
How Salesforce CRM works & who should use it?How Salesforce CRM works & who should use it?
How Salesforce CRM works & who should use it?
 
Salesforce CRM
Salesforce CRMSalesforce CRM
Salesforce CRM
 
Introduction to salesforce ppt
Introduction to salesforce pptIntroduction to salesforce ppt
Introduction to salesforce ppt
 
Salesforce Intro
Salesforce IntroSalesforce Intro
Salesforce Intro
 
Salesforce Presentation
Salesforce PresentationSalesforce Presentation
Salesforce Presentation
 

Similar a Cloud Entwicklung mit Apex

PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014
cagataycivici
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access Runbook
Taha Shakeel
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
AidIQ
 

Similar a Cloud Entwicklung mit Apex (20)

AnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFacesAnkaraJUG Kasım 2012 - PrimeFaces
AnkaraJUG Kasım 2012 - PrimeFaces
 
PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014PrimeTime JSF with PrimeFaces - Dec 2014
PrimeTime JSF with PrimeFaces - Dec 2014
 
Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2Build powerfull and smart web applications with Symfony2
Build powerfull and smart web applications with Symfony2
 
Primefaces Confess 2012
Primefaces Confess 2012Primefaces Confess 2012
Primefaces Confess 2012
 
How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF How to Bring Common UI Patterns to ADF
How to Bring Common UI Patterns to ADF
 
Cfml features modern coding into the box 2018
Cfml features modern coding into the box 2018Cfml features modern coding into the box 2018
Cfml features modern coding into the box 2018
 
Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012Integrating SAP the Java EE Way - JBoss One Day talk 2012
Integrating SAP the Java EE Way - JBoss One Day talk 2012
 
VPN Access Runbook
VPN Access RunbookVPN Access Runbook
VPN Access Runbook
 
Practica n° 7
Practica n° 7Practica n° 7
Practica n° 7
 
How te bring common UI patterns to ADF
How te bring common UI patterns to ADFHow te bring common UI patterns to ADF
How te bring common UI patterns to ADF
 
Ruby - Design patterns tdc2011
Ruby - Design patterns tdc2011Ruby - Design patterns tdc2011
Ruby - Design patterns tdc2011
 
Broadleaf Presents Thymeleaf
Broadleaf Presents ThymeleafBroadleaf Presents Thymeleaf
Broadleaf Presents Thymeleaf
 
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
Building the an End-to-End ASP.NET MVC 4, Entity Framework, HTML5, jQuery app...
 
GHC Participant Training
GHC Participant TrainingGHC Participant Training
GHC Participant Training
 
Architecting Alive Apps
Architecting Alive AppsArchitecting Alive Apps
Architecting Alive Apps
 
Flask – Python
Flask – PythonFlask – Python
Flask – Python
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scala
 
Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4Python Code Camp for Professionals 4/4
Python Code Camp for Professionals 4/4
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Symfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technologySymfony2 Building on Alpha / Beta technology
Symfony2 Building on Alpha / Beta technology
 

Último

KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
Cara Menggugurkan Kandungan 087776558899
 
the Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentationthe Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentation
brynpueblos04
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
vikas rana
 

Último (14)

Pokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy TheoryPokemon Go... Unraveling the Conspiracy Theory
Pokemon Go... Unraveling the Conspiracy Theory
 
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Jasola (Delhi)
 
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Mukherjee Nagar (Delhi)
 
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Dashrath Puri (Delhi)
 
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
KLINIK BATA Jual obat penggugur kandungan 087776558899 ABORSI JANIN KEHAMILAN...
 
WOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptxWOMEN EMPOWERMENT women empowerment.pptx
WOMEN EMPOWERMENT women empowerment.pptx
 
the Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentationthe Husband rolesBrown Aesthetic Cute Group Project Presentation
the Husband rolesBrown Aesthetic Cute Group Project Presentation
 
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
2k Shots ≽ 9205541914 ≼ Call Girls In Palam (Delhi)
 
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
(Aarini) Russian Call Girls Surat Call Now 8250077686 Surat Escorts 24x7
 
LC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdfLC_YouSaidYes_NewBelieverBookletDone.pdf
LC_YouSaidYes_NewBelieverBookletDone.pdf
 
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Morcall Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
call Now 9811711561 Cash Payment乂 Call Girls in Dwarka Mor
 
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
(Anamika) VIP Call Girls Navi Mumbai Call Now 8250077686 Navi Mumbai Escorts ...
 
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
$ Love Spells^ 💎 (310) 882-6330 in West Virginia, WV | Psychic Reading Best B...
 
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Tingre Nagar ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 

Cloud Entwicklung mit Apex

  • 1. Cloud Entwicklung mit Apex
  • 2. Apex? Apex Code extends the powerful and proven success of the Force.com platform by introducing the ability to write code that runs on salesforce.com servers.
  • 3. MVC
  • 4. Use Case Beschwerde Managment Anforderung: Konversationen sollen auf der Case-Seite möglichst schnell editierbar sein.
  • 6. Views & Controller Aufruf 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. Controller Extensions Für eine bessere Integration in SalesForce! ( https://emea.salesforce.com/5002000000MVOBr ) <apex:page standardController="Case" extensions="CaseControllerTest"> Hallo {!caseID} ! </apex:page>
  • 8. Controller Extensions Fü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. Add new Conversation Was brauchen wir? Formular für neues Conversation-Object. Save-Funktion
  • 10. Add new Conversation Controller 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. 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. The Action-Function public 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. Conversation List public 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. 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. 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. Select a Conversation public 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. 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>