You need to sign in to do that
Don't have an account?
Pawan Kumar 32
Create a Visualforce page which shows a basic Contact record
Hello All,
I am stuck in below trailhead chanllange. Please help me.
Using the Contact standard controller, create a Visualforce page which displays a Contact's First Name, Last Name and the Email address of the Contact's Owner.The page must be named 'ContactView'.
It must reference the Contact standard controller.
It should include a bound variable that uses the standard controller to display the first name of the Contact.
It should include a bound variable that uses the standard controller to display the last name of the Contact.
It should include a bound variable that uses the standard controller to display the Contact Owner's email.
I am getting below error..
Challenge not yet complete... here's what's wrong:
The page does not include a bound first name variable for the Contact record
Please refer below screenshot for vf code.
I am stuck in below trailhead chanllange. Please help me.
Using the Contact standard controller, create a Visualforce page which displays a Contact's First Name, Last Name and the Email address of the Contact's Owner.The page must be named 'ContactView'.
It must reference the Contact standard controller.
It should include a bound variable that uses the standard controller to display the first name of the Contact.
It should include a bound variable that uses the standard controller to display the last name of the Contact.
It should include a bound variable that uses the standard controller to display the Contact Owner's email.
I am getting below error..
Challenge not yet complete... here's what's wrong:
The page does not include a bound first name variable for the Contact record
Please refer below screenshot for vf code.
Try this piece of code Thanks.
Contact Email: {! Contact.Email } <br/>
Should Be
Owner's Email: {! Contact.Owner.Email } <br/>
<apex:page sidebar="false" standardController="Contact">
<apex:pageBlock title="Contact Summary">
<apex:pageBlockSection>
First Name: {! Contact.firstname} <br/>
Last Name: {! Contact.lastname} <br/>
Owner Email ID: {! Contact.Owner.email}
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>
Ajay
Sorry for the Super late reply (Newbie to SF), You have probably figured it all out, anyways this is for reference to anybody having this issue.
The code i used to solve this unit is given below \,,/
Note: Typing this code will not show you the result on the Preview screen. If you want to see the output, you need to add the ID of any Contact Record in the Preview URL(Which can be tricky from badger). You need to login to your developer edition and try concatenating the Record ID if you are particular to see the output for yourself.
Do not worry about what you are not seeing on the preview screen, Save this code and Check Challenge, you are through to the next Unit :)
Cheers,
Sachin Ks
Good Explanation, moreover coming to the second part of your answer which says "you need to add the ID of any Contact Record in the Preview URL(Which can be tricky from badger)." Well in this case will navigate to the Contact-->click on any particular contact-->note the in this page (in the URL section) there would be an unique id, something like this https://ap5.lightning.force.com/one/one.app#/sObject/0037F000001oU2FQAU/view which is in my case (highlighted one), take this and paas it in your visualforce preview page along with "&id=0037F000001oU2FQAU", Hope it helps.
Cheers,
Mayur Tripathi
Best regards,
Abhi
I'm trying to implement something similar to the original post and wondered about a few things:
1) How would you pull in a whole page section of fields from a contact record into a VF page using standard controller?
2) How would you pull in certain related lists on the contact record?
3) How can you ensure a logged-in user see only their own contact record data in these VF pages and no one elses?
If anyone has any links on this or has done similiar, any help would me massively appreciated. Thanks.
Now my qs is in lightning if i see Fields and Relationship for User in Object manager, i cant see the Email field. But in Classic i can see in Build->Cutomize->Users->Fields
So if i want to know which field to refer in a look up relationship or the fields name and API names can i get it in lightning like i get it in classic?
<apex:page standardController="Contact" >
<apex:pageBlock title="Contact Record">
First Name: {! Contact.FirstName} <br/>
Last Name: {! Contact.LastName} <br/>
Owner Email: {! Contact.Owner.Email} <br/>
</apex:pageBlock>
</apex:page>
That's enough.
Hi Charlie,
this is a function of the name type field that is a composite field, you don't need create a custom fields.
use this code.
<apex:page standardController="Contact" recordSetVar="Contacts">
<apex:pageBlock title="ContactView">
<apex:pageBlockSection >
First Name: {!Contact.FirstName} <br/>
Last Name: {!Contact.LastName} <br/>
Owner Email:{!Contact.Owner.Email} <br/>
</apex:pageBlockSection>
</apex:pageBlock>
</apex:page>