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
pavan 14pavan 14 

how i can show visualforce on custom object pagelayout

could any one explain even though i wrote standard controlller 
 <apex:page standardController="japan__c" recordSetVar="jap">
    <apex:dataTable value="{!jap}" var="a">
        <apex:column value="{!a.name}" />
    </apex:dataTable>
</apex:page>
User-added image
i am unable to see Visualforce in page layout. do i need enable anything in specific . 
Best Answer chosen by pavan 14
PawanKumarPawanKumar
Hi,
A VisualForce page can only be added to an object's Page Layout if it declares the standardController attribute and its type must match(RecordSetVar should not there). I mean to say that you can not display ListController related VF in page layout. To check this concept, you please save the below VF in your instance then open page layout, it will be visible for you.

<apex:page standardController="japan__c">
</apex:page>


However, if you want to display your list of records then you use extension controller then store your list of records into one of your Controller property then iterate that list property in your VF. 

e.g.
VF
-----------------------
<apex:page StandardController="Account" extensions="ExtController" readOnly="true">
<apex:pageBlock >
   <apex:pageBlockTable value="{!esProjList}" var="eachSubProject" rendered="{!(subProjList.size != 0)}">
   </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

// controller
----------------------------------
public with sharing class ExtController {
    public static Account currentAccount;
    
    public List<ANYCUSTOMOBJECT> esProjList{
    get{
        if(esProjList==null){
            esProjList = [Select Id,Name,Owner.Name FROM ANYCUSTOMOBJECT where ACCOUNTIDLOOKUPFIELD=:currentAccount.Id];
        }
        return esProjList;
    }
    
    private set;
    }
    
    public ESCompanyRelatedProjectsCnt(ApexPages.StandardController stdController) {
        currentAccount = (Account)stdController.getRecord();
    }
    
}// END - Controller

Regards,
Pawan Kumar

 

All Answers

PawanKumarPawanKumar
Hi ,
Please check below link that will solve your problem.
https://developer.salesforce.com/forums/?id=906F0000000AUdbIAG

Regards,
Pawan Kumar
PawanKumarPawanKumar
one more suggestion, as your page is using List Controller so you can click on related List in page Layout (where you have written NO VF Page). You will get VF right side.
pavan 14pavan 14
Hi Pawan,

Thanks for reply .But still then i am unable to get as you said .Could you help with any other alternate soultion that would be really helpful.

Regards
Pavan.
PawanKumarPawanKumar
Hi,
A VisualForce page can only be added to an object's Page Layout if it declares the standardController attribute and its type must match(RecordSetVar should not there). I mean to say that you can not display ListController related VF in page layout. To check this concept, you please save the below VF in your instance then open page layout, it will be visible for you.

<apex:page standardController="japan__c">
</apex:page>


However, if you want to display your list of records then you use extension controller then store your list of records into one of your Controller property then iterate that list property in your VF. 

e.g.
VF
-----------------------
<apex:page StandardController="Account" extensions="ExtController" readOnly="true">
<apex:pageBlock >
   <apex:pageBlockTable value="{!esProjList}" var="eachSubProject" rendered="{!(subProjList.size != 0)}">
   </apex:pageBlockTable>
</apex:pageBlock>
</apex:page>

// controller
----------------------------------
public with sharing class ExtController {
    public static Account currentAccount;
    
    public List<ANYCUSTOMOBJECT> esProjList{
    get{
        if(esProjList==null){
            esProjList = [Select Id,Name,Owner.Name FROM ANYCUSTOMOBJECT where ACCOUNTIDLOOKUPFIELD=:currentAccount.Id];
        }
        return esProjList;
    }
    
    private set;
    }
    
    public ESCompanyRelatedProjectsCnt(ApexPages.StandardController stdController) {
        currentAccount = (Account)stdController.getRecord();
    }
    
}// END - Controller

Regards,
Pawan Kumar

 
This was selected as the best answer
pavan 14pavan 14
Thanks! Solved 
John Wilkins 10John Wilkins 10
Hi Pavan,
I am trying to do the same but am unable to replicate the excellent sugestion above- could you post your code please as it may help me resolve my issue?
Thanks 
nazim zmirlinazim zmirli
I know lightning doesn't support javascript buttons. I know there alternatives to do this with actions and lightning components. I'm asking how to do something that according to my research is supported but doesn't seem to work.
see: ShowBox (https://showbox.onl/) Mobdro (https://mobdro.onl/) Vidmate (https://vidmate.onl/)
Johny SinsJohny Sins
Hi, I am Johny Sins from Plumbers in Mississippi (https://www.edocr.com/user/plumbersinmississippi). Apart from this nice post. Thanks for sharing.
roy merrroy merr
It is a nice article and you explained in a detailed way. Thanks for sharing this to us. Would you like to know more about how to generate psn codes? Check this for getting more details about this. https://psncode.site
Hin ChHin Ch
Dear !!!! Nice information, 3nx for sharing great content……   
(https://packagespoint.com)

 
waleed sheikhwaleed sheikh
thanks for sharing 
https://projectfreetvus.com/
lakhwinder singh 9lakhwinder singh 9
Here is the list of latest whatsapp status collection you can share love, sad, attitude, romantic, attitude, sad, cool, friendship status and quotes from Whatsapp Love Status and share with you husband, wife, boyfriend, girlfriend, boys, girls in diffrent language hindi, punjabi, tamil, englis, marathi.
Whatsapp Love Status (https://lovestatusz.com)