You need to sign in to do that
Don't have an account?

Issue with class and Visualforce page for custom object
I want to get the id for a record in an object called patient__C and render the patient detail page in a VF page without having to specify each detail field. I have created the standard controller Patient to get the record id and get the error This gives error: Illegal Assignment List to List:
public with sharing class Patient {
public String patientId{get;set;}
public Patient(){
String pat = apexpages.currentPage().getParameters().get('Id');
List<patient> patID = [Select id from Patient__c where id = :pat Limit 10];
}
}
Here is the visualforce page code:
<apex:page standardController="Patient">
<apex:detail />
</apex:page>
Can anyone tell me what I am doing wrong?
public with sharing class Patient {
public String patientId{get;set;}
public Patient(){
String pat = apexpages.currentPage().getParameters().get('Id');
List<patient> patID = [Select id from Patient__c where id = :pat Limit 10];
}
}
Here is the visualforce page code:
<apex:page standardController="Patient">
<apex:detail />
</apex:page>
Can anyone tell me what I am doing wrong?
Please try to change your code like this i have developed it for Contact :
Mistakes in your code:
1. You are not using API name of the object in standardController="Patient" it should be Patient__c
2. You did not provide Subject on visualforce page
3. You did not use extensions="Name of your class" so it should be extensions="Patient"
So your code should be like: In order to test you could open the page with any record id.
Let me know if you still face issue.
Thanks
Shashikant
All Answers
Please try to change your code like this i have developed it for Contact :
Mistakes in your code:
1. You are not using API name of the object in standardController="Patient" it should be Patient__c
2. You did not provide Subject on visualforce page
3. You did not use extensions="Name of your class" so it should be extensions="Patient"
So your code should be like: In order to test you could open the page with any record id.
Let me know if you still face issue.
Thanks
Shashikant
I updated my code to the following and am still receiving errors:
Any ideas?
Thank you so much for your help!
Thanks
Thanks
Shashikant