2

I am trying to display detail of a custom object by using apex:detail. But i am getting no a blank page without any details i try it with Account but it was not working.

 <apex:page standardController="CustomObjectA__c">
   <apex:detail subject="{!CustomObjectA__c.id}" relatedList="true" title="false"/> 
 </apex:page>

please help me to get it solved.

4

With a standard controller, <apex:detail /> without a subject should be sufficient, but you must pass an id to the page, e.g., http://c.naX.visual.force.com/apex/detailTest?id=a03E00000082KUi.

| improve this answer | |
0

For Standard Controller you need to Pass CustomObjectA__c object record Id in the URL...

i.e., /apex/page?id=RecordId

| improve this answer | |
0

I have a feeling that you may not have a property in your controller to represent the specific CustomObjectA__c you are referencing.

Since you are using the standard controller, this can be done pretty easily.

In your controller

public class MyCustomExtension{

    public CustomObjectA__c myObject   {get;set;}

    public MyCustomExtension(ApexPages.StandardController controller) {
        this.myObject= (CustomObjectA__c)controller.getRecord();
    }

}

And adjust your VF to use your new property

<apex:page standardController="CustomObjectA__c" extensions="MyCustomExtension">
    <apex:detail subject="{!myObject.id}" relatedList="true" title="false"/> 
</apex:page>
| improve this answer | |
  • sfdc_ninja: you are missing the extensions="MyCustomExtension" from the apex:page line; however, I think Jason Clark has the real answer here – cropredy Oct 8 '14 at 1:49
-1

Also, silly one but, the "id" in the query string is case sensitive.

Having that wrong (or some other typo in the query string parameters) will produce the same behaviour as you are receiving.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy