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