Friday, 7 September 2012

Create a Controller Extension - Visualforce


Controller extensions are Apex classes. Creating your first Apex class is as easy as creating your first Visualforce page.
  1. Click Setup | Develop | Apex Classes.
  2. Click New.
  3. Enter the following as the body of the Apex class:
    public class MyExtension {
        private final Account acct;
        
        public MyExtension(ApexPages.StandardController controller) {
            this.acct = (Account)controller.getRecord();
        }
        public String getTitle() {
            return 'Account: ' + acct.name + ' (' + acct.id + ')';
        }
    }
This is an Apex class named MyExtension that has an instance variable named acct. It has a constructor that retrieves the record from the controller parameter, and saves it in the acct variable. The class also has a method called getTitle() that returns a string containing the account’s name and identifier.
Most extensions have this form—with the constructor being the key ingredient. When the extension is used, Visualforce automatically invokes the constructor, passing in the controller for the page being viewed. This controller provides access to the record being viewed.

19 comments:

  1. it was a really nice article and i was really impressed by seeing this
    article We are also giving linux course online training.the Linux-
    Online-Training
    is the one of the best Online Training institute.

    ReplyDelete
  2. Thanks admin, for sharing your valuable post about cloud computing.
    Salesforce Training in Chennai

    ReplyDelete
  3. Hi Avaram Technologies,
    I want to Learn Salesforce, but I am in Chennai. Do you offer salesforce training in Chennai? My friends are recommending this Salesforce Training in Chennai. Whats your opinion about this institute? I am a longtime follower of your blog and I just happened to see this article.

    Thanks
    Mike

    ReplyDelete
    Replies
    1. It great institute to pursue cloud computing training in Chennai. They offer professional training on this domain through industrial experts.

      Delete
  4. The Information which you provided is very much useful for Salesforce Training Learners Thank You for Sharing Valuable Information.i like this blog and this is very informative.

    Salesforce Training in Chennai



    ReplyDelete
  5. Thanks for sharing informative article on Salesforce technology. Your article helped me a lot to understand the career prospects in cloud computing technology. Salesforce.com Training in Chennai

    ReplyDelete

  6. I have read your post, it was good to read & i am getting some useful info's through your blog keep sharing...Salesforce is a new technology which helps you to get your career destination. Learn salesforce from corporate professionals with very good experience in Salesforce CRM.
    Salesforce training in Chennai|Salesforce courses in Chennai

    ReplyDelete
  7. The information you have given here is truly helpful to me. CCNA- It’s a certification program based on routing & switching for starting level network engineers that helps improve your investment in knowledge of networking & increase the value of employer’s network, if you want to take ccna course in Chennai get into FITA, thanks for sharing…
    ccna training in Chennai | ccna training institute in Chennai | ccna training chennai

    ReplyDelete
  8. The great and valuable information are here.It is very easy to tell about overall performance.I like this article so much. Thank You.
    Cloud Computing Training in chennai | Cloud Computing Training chennai | Cloud Computing Course in chennai | Cloud Computing Course chennai

    ReplyDelete
  9. Hi friends,This is Christy from Chennai.Thanks for sharing this informative blog. I did Unix certification course in Chennai at Fita academy. This is really useful for me to make a bright career. Suppose if anyone interested to learn Unix Training Chennai please visit Fita academy located at Chennai.
    Regards..
    Unix Training

    ReplyDelete
  10. Your blog is really nice and informative. Thanks for sharing this post. Keep posting..

    Regards..
    Salesforce Training in Chennai

    ReplyDelete
  11. Hi friends, This is Murali from Chennai. I am a technology freak. Your technical information is really useful for me. Keep update your blog.
    Regards..
    Oracle Training Center in Chennai

    ReplyDelete
  12. Really awesome blog. Your blog is really useful for me. Thanks for sharing this informative blog. Keep update your blog. Recently I did Software Testing Training in Chennai at a reputed training institutes.

    ReplyDelete
  13. Salesforce can help you get the most out of the platform.Training is required for someone to gets introduced to a new job or roll out a business change.For more details salesforce training in hyderabad

    ReplyDelete
  14. Nice Article! Mostly I have gathered knowledge from the blogger, because its provides more information over the books & here I can get more experienced skills from the professional, thanks for taking your to discussing this topic.
    Regards,
    Informatica training in chennai|Best Informatica Training In Chennai

    ReplyDelete
  15. Good Post! Thank you so much for sharing this pretty post, it was so good to read and useful to improve my knowledge as updated one, keep blogging…
    Regards,
    sas training in Chennai|sas training institutes in Chennai|sas training center in Chennai

    ReplyDelete
  16. Great post!

    http://www.dwbiadda.com/courses/salesforce-training/

    ReplyDelete
  17. It's a grateful information.It's easy to understand and then overall this blog information perforation is really well.
    Selenium Training in Chennai
    Selenium Training Institute in Chennai

    ReplyDelete