Wednesday, July 6, 2016

How to display value of fields in Visualforce Page Salesforce?

In this guide, I'm going to show you how to get started with Visualforce Page by display value of fields from a record in Visualforce Page.

Follow these step-by-step instructions to display Field Values with Visualforce.

Step 1: Login Salesforce => Create your Salesforce Project => Create your visualforce page

To display value of fields from a record in Visualforce Page you need to create a visualforce page. If you need more information for this step, please click:
 + How to create New Salesforce Project with MavensMate In Sublime Text 3: http://salesforcexq.blogspot.com/2016/07/Installing-MavensMate-with-Sublime-Text-3.html 
 + How to create a Visualforce page: http://salesforcexq.blogspot.com/2016/07/what-is-visualforce-introduction-to-visualforce-pages.html
For example:
<apex:page>
    Hello
</apex:page>

Step 2: Add the standardController attribute to the tag.

To access fields from a record data such as: User, Account, Contact, ... or custom object record, you need to associate your page with a controller.

Salesforce includes standard controllers for every standard object and custom object with basic database operations, such as queries.

For example, to display an Contact's name on a visualforce page, use the standard controller for Contact, add the standardController attribute to the tag.
<apex:page standardcontroller="Contact">
    Hello
</apex:page>

Step 3:  Access fields on the record

You can now access fields on the SObject record currently in context by using syntax: {!<sObject>.<fieldname>}
For example, to display an user's name on a page, use {!contact.name}.
<apex:page standardcontroller="Contact">
    Hello <br/>
    {!contact.name}
</apex:page>

The {!contact.name} expression makes a call to the getRecord() method in the standard Contact controller to returns the record that is currently in context, based on the value of the id query string parameter in the Visualforce page URL. It then uses dot notation to access the name field for that record.

Step 4: Add a query parameter to the page URL 

To access an Contact record, you must add a query Id parameter to the page URL. To do this:
+ Find the ID of an Contact.

+ Add the Contact ID as a query string parameter to the end of the URL in your browser's address bar. For example: https://c.ap2.visual.force.com/apex/HelloPage?id=0032800000U4mkzAAB

* Result *

7 comments:

  1. Good post. Its so much useful to learners. I like the way you describe this post. Thanks for sharing. It looks like you spend a lot of effort and time on your blog. Step by step explanation process is given. Got to learn new things from your Blog.
    Salesforce Tutorial

    ReplyDelete
  2. The information you provided in this Blog is very useful and The information is worth and very useful for the beginners. It distributes cloud computing software to businesses to help them manage their sales. If You Want More Details About Salesforce Click here.

    ReplyDelete
  3. Keto SLIM Max; Because of high out-of-pocket expenses, Ohioans who purchase subsidized health-exchange insurance often can't afford the care they need when they need it. That is a central finding of a new study from researchers at Case Western Reserve University School of Medicine.A diet of neutral magnesium and calcium is necessary for healthy bones and teeth. It also contains the fat and cholesterol, however, research has shown that eggs do not increase the risk for heart disease. The first such week was held in 1982 and aimed to highlight the causes of malnutrition and how to reduce it. A healthy diet lies at the core of good health and weight loss.Workplace wellness programs can include things like onsite fitness centers, health presentations, wellness newsletters, access to health coaching, tobacco cessation programs and training related to nutrition, weight and stress management Other programs may include health risk assessments, health screenings and body mass index monitoring.Legumes such as toor dal are a healthy source of dietary fiber, which can help to prevent constipation and promote regularity. People who include more low-glycemic foods in their diet have lower rates of diabetes. Health care is the prevention, treatment, and management of illness and the preservation of mental and physical well being through the services offered by the medical, nursing, and allied health professions.Your heart might not work properly in the long run on consuming excessive amount of junk foods. Since all the body's blood flows through the heart, it is best to keep that muscle as healthy as possible, so your body can receive fresh, clean blood to function.
    http://www.garciniamarket.com/keto-slim-max/

    ReplyDelete
  4. http://maps.google.co.zw/url?q=https://fitcareketo.com/
    http://maps.google.co.zm/url?q=https://fitcareketo.com/
    http://maps.google.co.za/url?q=https://fitcareketo.com/
    http://maps.google.co.ve/url?q=https://fitcareketo.com/
    http://maps.google.co.mz/url?q=https://fitcareketo.com/

    ReplyDelete
  5. Thenutritionsclinic teaches you how to be glad and healthy on the same time, and that's always a good component. Holistic alternative remedy is one of the many facets of fitness care that edward koop discusses in his diverse writings. He believes that clients can significantly gain no longer most effective from traditional remedy but additionally from different sorts of alternative medication therapy you probably heard the expression, "as inside so without."
    https://thenutritionsclinic.com/

    ReplyDelete
  6. Always so interesting to visit your site.What a great info, thank you for sharing. this will help me so much in my learning All Natural Tooth Care

    ReplyDelete