+ Start a Discussion
sandip beherasandip behera 

Cannot See Visualforce pages in Content Source dropdown.

I cannot see Visualforce pages  in Content Source dropdown while creating custom button for a custom object.
I had created number of  Visualforce page. One example is

<apex:page standardController="Account" recordSetvar="accounts">
<apex:pageBlock title="Viewing Accounts"> <apex:form id="theForm">
<apex:panelGrid columns="2">
<apex:outputLabel value="View:"/>
<apex:selectList value="{!filterId}" size="1">
<apex:actionSupport event="onchange" rerender="list"/>
<apex:selectOptions value="{!listviewoptions}"/>
</apex:selectList> </apex:panelGrid>
<apex:pageBlockSection >
<apex:dataList var="a" value="{!accounts}" id="list"> {!a.name} </apex:dataList>
</apex:pageBlockSection> </apex:form> </apex:pageBlock>
</apex:page>
Please help me.
Thanks
 
Best Answer chosen by sandip behera
Mahesh DMahesh D
Hi Sandip,

Please check the below code:
 
<apex:page standardController="Custom_Object__c" extensions="OrdertoSales" tabStyle="Opportunity">
	<apex:form > 
		<apex:pageBlock title="Copy to Sales Detail" mode="edit"> 
			<apex:pageBlockButtons > 
				<apex:commandButton action="{!copy}" value="Copy" /> 
				<apex:commandButton action="{!cancel}" value="Cancel"/> 
			</apex:pageBlockButtons> 
			<apex:pageBlockSection title="Information" columns="1"> 
				<apex:inputField value="{!Order.Name}"/> 
				<apex:inputField value="{!Order.expected_order_date__c}"/> 
				<apex:inputField value="{!Order.memo__c}"/> 
				<apex:inputField value="{!Order.order__c}"/> 
				<apex:inputField value="{!Order.stage__c}"/>
				<apex:inputField value="{!Order.start_date__c}"/> 
			</apex:pageBlockSection> 
		</apex:pageBlock> 
	</apex:form>
</apex:page>

This will show as a Content Source as we are using the standardController as Custom_Object__c.

Please do let me know if it helps you.

Regards,
Mahesh


 

All Answers

Mahesh DMahesh D
Hi Sandip,

You have to mention the standardController="Custom_Object__c" then it will show you the current page.

whatever the value / object you give for standardController, for the same object you can use this VF page.

Please do let me know if it helps you.

Regards,
Mahesh
sandip beherasandip behera
Hi mahesh,
I had a visualforce page like 
<apex:page controller="OrdertoSales" tabStyle="Opportunity">
<apex:form > <apex:pageBlock title="Copy to Sales Detail" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!copy}" value="Copy" /> <apex:commandButton action="{!cancel}" value="Cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection title="Information" columns="1"> <apex:inputField value="{!Order.Name}"/> <apex:inputField value="{!Order.expected_order_date__c}"/> <apex:inputField value="{!Order.memo__c}"/> <apex:inputField value="{!Order.order__c}"/> <apex:inputField value="{!Order.stage__c}"/> <apex:inputField value="{!Order.start_date__c}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form>
</apex:page>

In the above code I use controller attribute in Apex:page.  OrdertoSales is a apex class .  Can  you plz tell me why I cannot see this page in
Content Source dropdown while creating custom button for a custom object.
 
Mahesh DMahesh D
Hi Sandip,

Please check the below code:
 
<apex:page standardController="Custom_Object__c" extensions="OrdertoSales" tabStyle="Opportunity">
	<apex:form > 
		<apex:pageBlock title="Copy to Sales Detail" mode="edit"> 
			<apex:pageBlockButtons > 
				<apex:commandButton action="{!copy}" value="Copy" /> 
				<apex:commandButton action="{!cancel}" value="Cancel"/> 
			</apex:pageBlockButtons> 
			<apex:pageBlockSection title="Information" columns="1"> 
				<apex:inputField value="{!Order.Name}"/> 
				<apex:inputField value="{!Order.expected_order_date__c}"/> 
				<apex:inputField value="{!Order.memo__c}"/> 
				<apex:inputField value="{!Order.order__c}"/> 
				<apex:inputField value="{!Order.stage__c}"/>
				<apex:inputField value="{!Order.start_date__c}"/> 
			</apex:pageBlockSection> 
		</apex:pageBlock> 
	</apex:form>
</apex:page>

This will show as a Content Source as we are using the standardController as Custom_Object__c.

Please do let me know if it helps you.

Regards,
Mahesh


 
This was selected as the best answer