1
    Public Class SalesOrderLayoutCom{
        public List<Sales_Order__c> OrderIdList{get;set;}
        public List<Sales_Order__c> oppIdList{get;set;}
        Public SalesOrderLayoutCom() {
            OrderIdList=new List<Sales_Order__c>();
            oppIdList=new List<Sales_Order__c>();
            OrderIdList=[Select id from Sales_Order__c where Opportunity__r.StageName='Closed Won'];
            //oppIdList=[Select Id from Opportunity where Sales_Order__c.id  in : OrderIdList];

        }
}
| improve this question | | | | |
  • 1
    Not sure what you are trying to ask in this post. First, yes, it is okay to insert a VF page into custom page layout. Second, what is your point for pasting this piece of code? It doesn't make much sense – Lance Shi Jul 29 '15 at 7:15
1

Yes you can add visual force page in the custom object layout. Here is how.

To be able to embed a Visual Force page into page layout, the VF page should be using the standard Controller tag referencing same entity for which this page will be used in page layout . You can use/add this visual force page by modifying the page layout.

A simple Visual force page using the Standard Opportunity Controller.

<apex:page standardController="Opportunity" tabStyle="Opportunity">
    <apex:pageBlock>
        <apex:pageBlockSection title="Opportunity Information">
            <apex:outputField value="{!opportunity.name}"/>
            <apex:outputField value="{!opportunity.amount}"/>
            <apex:outputField value="{!opportunity.closeDate}"/>
        </apex:pageBlockSection>
    </apex:pageBlock>
</apex:page>

After this, this page should show in Page Layout editor and can be embedded on a page layout for Opportunity.

Here is a reference screenshot showing how to add VF page in layout. enter image description here

Source: - 1 - https://help.salesforce.com/apex/HTViewSolution?id=000005105&language=en_US
Source: - 2 - http://support.drawloop.com/loop-storage/create-custom-visualforce-page

| improve this answer | | | | |
  • @Ravi f it was the answer can you please mark it as answer. Thanks. – Saroj Bera Aug 4 '15 at 6:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.