+ Start a Discussion
Saroja MuruganSaroja Murugan 

Visual force page error

Hi All,

When im tryin to run my visual force code its shows the below error.

User-added image
Can anyone guide how to solve this problem?

Sweet Potato Tec
Gaurish Gopal GoelGaurish Gopal Goel
Hi Saroja,

Follow these steps:
1. Go to Setup
2. Quick find "Profiles"
3. Go to your user's profile
4. Add your Visualforce page in the related list "Enabled Visualforce Page Access" of that profile. See the screenshot for reference:

User-added image
Saroja MuruganSaroja Murugan
Hi Gaurish,

Thank for the replay.

Already the vf page add to the user profile and the user profile is System Administrator. 
Gaurish Gopal GoelGaurish Gopal Goel
Oh your ID parameter is wrong in the URL or somewhere in the controller. You need to put the correct ID.
Saroja MuruganSaroja Murugan
Here is my page and controllor.

Can you please tell me in which ID parameter is wrong?

Vf page

<apex:page standardController="Contact" extensions="RelatedController1">
<apex:form >
    <apex:pageBlock mode="Main detils">
        <apex:pageblockButtons >
            <apex:commandButton value="save" action="{!save}"/>
            <apex:commandButton value="Cancel" action="{!cancel}"/>
        <apex:pageBlockSection title="Contact details">
            <apex:inputField value="{!contact.LastName}"/>
            <apex:inputField value="{!contact.FirstName}"/>
       <apex:pageblockSection title="Contact" id="scholid">
           <apex:inputField value="{!contact.School__r.Id}">
            <apex:actionSupport event="onchange" action="{!SchoolPopulated}" rerender="scholid, msgs" status="stat"/> 
          <apex:outputField value="{!contact.School__r.First_Name__c}"/>   
           <apex:outputField value="{!contact.School__r.Lastname__c}"/>   
           <apex:actionstatus startText="Getting Details" id="stat"></apex:actionstatus>


public with sharing class RelatedController1
 private ApexPages.StandardController stdCtrl;
 public RelatedController1(ApexPages.StandardController std)
 public void SchoolPopulated()
  Contact cont=(Contact) stdCtrl.getRecord();
      cont.School__r=[select First_Name__c,Lastname__c from School__c where id=:cont.School__r.Id];

Here Contact is child and School__c is parent.
Gaurish Gopal GoelGaurish Gopal Goel
Please send me the URL you are using to view your VF page.
Saroja MuruganSaroja Murugan
When im click a preview button its show that error.

And im expecting output like below

User-added image

But its shows me like me the error.

And i refer the below link to achieve this.


Gaurish Gopal GoelGaurish Gopal Goel
so you need to pass a parameter in the URL like this:

Replace "YOURPAGENAME" with your actual VF Page name
Replace "CONTACTID" with an actual Contact record ID.