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
BB 

How to make my visualforce page available for other objects

I  want to use this in other object like oportunity for example

<apex:page standardController="Account" extensions="AccountWrapper" >
  <apex:form >
    <apex:commandbutton value="Button" 
                    onclick="window.location='/a0A/e?asdo={!opp.Name}&asd={!opp.Id}&retURL=%2F{!opp.Id}&
                             RecordType=1234&{!sol.Solution_Country__c}={!Account.Country__c}&
                             CurrencyIsoCode={!opp.CurrencyIsoCode}&ent=01ID0000000uXce'; return false;"/>
    </apex:form>
    
</apex:page>    
 

Is there any solution for that ? I can see it only in account but i want to see it in opportunity or solution etc 
 
Best Answer chosen by B
Khan AnasKhan Anas (Salesforce Developers) 

Hi,

Greetings to you!


A Visualforce page can only be added to an object's Page Layout if it declares the standardController attribute and its type must match i.e; you need to associate the standard controller of the page to the same object.

However, you can create a custom Visualforce Component and move your VF code to a VF Component. 

You can then create two VF pages which each include the same component and use the respective standard controller on the VF Page and you can use a custom controller for your component. 

https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_comp_cust.htm

I hope it helps you.

Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.

Thanks and Regards,
Khan Anas