function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Yash RathodYash Rathod 

Unable to Create a Visualforce page which shows a basic Contact record

Hi, 

I've created a Visualforce page which shows a basic Contact record using standard controller. Below is the code:
 
<apex:page standardController="Contact">
    <apex:pageBlock title="COntact Summary">
        <apex:pageBlockSection>
            $A.get("e.force:navigateToURL").setParams(
    {"url": "/apex/pageName?&id=0037F000007xdK4QAI"}).fire();
            First Name: {! Contact.FirstName} <br/>
            Last Name: {! Contact.LastName} <br/>
            Contact Owner's Email: {! Contact.Owner.Email} <br/>
        </apex:pageBlockSection>
    </apex:pageBlock >
</apex:page>

But, when preview it after saving, everytime it prompts " PAGE NOT SAVED. You have uncommitted changes to this VisualForce page. This preview will show the most recently committed version of this page, not your current changes." Also the preview page is blank. 

I would like to know what is missing here. I am not able to solve it.
 
NagendraNagendra (Salesforce Developers) 
Hi Yash,

Please try the below piece of code which is working fine for me.
<apex:page standardController="Contact">
  <apex:pageBlock title="Account Summary">
        <apex:pageBlockSection >
            First Name: {! Contact.FirstName } <br/>
            Last Name: {! Contact.LastName } <br/>
            Owner's Email: {! Contact.Owner.Email } <br/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>
Hope this helps.

Please mark this as solved if it's resolved.

Thanks,
Nagendra
 
Yash RathodYash Rathod
Hi Nagendra, I've already solved it with similar code before, but I don't know what is the problem in my code when I try to get users detail using URL. Hope you could help with my code.
Arun Bala 21Arun Bala 21
Nice one Nagendra, I was trying {!contact.Account.Owner.Firstname} though that works, 
I can't find the API names (first & last name) exposed for standard controller in the sObject, 
Salesforce should display this, only way to know is through trailhead docs. or blogs like this !