The My Notes Console Footer Component

Available in: Salesforce Classic

This is part of Developing with the Service Cloud.

Note this code requires the creation of a My_Notes custom object which contains a Note rich text field.

Please note that this is sample code. It must be enhanced and tested to production quality as required if you choose to utilize it.

The Apex Controller.

public class MyNotesController {

    public void setNotes() {
        myNotepad.note__c = Notes;
        update myNotepad;
    My_Notes__c myNotepad;
    Integer notesCount;
    public String Notes{ get; set;} 

    public MyNotesController() {
         notesCount = [Select COUNT() from My_Notes__c where ownerId = :UserInfo.getUserId()];
    public void init() {
         My_Notes__c  notesObject;
         if (notesCount == 0) {
             notesObject = new My_Notes__c();
             notesObject.ownerId = UserInfo.getUserId();
             insert notesObject;
         } else {
             notesObject = [Select Note__c from My_Notes__c where ownerId = :UserInfo.getUserId()LIMIT 1];             
         myNotepad = notesObject;
         Notes = notesObject.note__c;
    static testMethod void myTestHardcodedIds(){
        MyNotesController mNC= new MyNotesController();

The Visualforce Page

<apex:page controller="MyNotesController" action="{!init}">
     <apex:includeScript value="/support/console/25.0/integration.js"/>
        body { margin: 0; padding: 0; overflow: hidden; }
        html { height:100%;}
        html body.sfdcBody {
            //background-color: #FFFFCC;
            margin: 0px;
    <textarea id="notesInput" style="border:none;background-color:#FFFFCC; width:100%; height:100%;" 

    <apex:form >
        <apex:actionFunction action="{!setNotes}" name="setNotesJS" reRender="">
            <apex:param name="note" assignTo="{!Notes}" value=""/>
        var notesTextArea = document.getElementById('notesInput');        
        function saveNotes() {
        var listener = function (result) {
            document.getElementById('notesInput').innerHTML += '\nMessage Received: ' + result.message;

        // add a listener for the 'SampleEvent' event type
        sforce.console.addEventListener('updateMyNotes', listener);

The code above must be added to a Visualforce page. A new custom Console component pointing to this VF page must then be created in setup. Finally this new component must be added to the Console footer bar via the Console configuration page.