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
Daniel MasonDaniel Mason 

Unable to Override (Related List) New Button? VF Page not selectable

Hope all is well.

I am a newbie to visual force and apex and have looked at various documentation online. (Especially this pdf, however i really need some SF expertise from the community to help me get this over the line, as i dont know how to proceed.

Required outcome : User goes to the sales_and_marketing__c object, scrolls to the related list called Materials_Junction__c. Upon clicking the"new" button the following visual page below should be presented. The user would then select the appropriate products (using the tickbox) and adding an quantity number. Upon pressing save, the values selected should be mapped back to the sales_and_marketing__c object,

Visual Force page 
<apex:page controller="testWrapper">
<script type="text/javascript">
        function selectAllCheckboxes(obj,receivedInputID){
            var inputCheckBox = document.getElementsByTagName("input");
            for(var i=0; i<inputCheckBox.length; i++){
                    inputCheckBox[i].checked = obj.checked;
    <apex:form >
        <apex:pageBlock title="Select Product">

            <apex:pageBlockButtons >
                <apex:commandButton value="Save" action="{!save}"/>
            <apex:pageBlockTable value="{!materialWrapperList}" var="MKT"> <!-- for loop of contact in Materials -->
                <apex:column >
                        <apex:facet name="header">
                            <apex:inputCheckbox onclick="selectAllCheckboxes(this,'inputId')"/>
                        <apex:inputCheckbox value="{!MKT.selectB}" id="inputId"/>
               <!-- <apex:column value="{!MKT.selectB}"/>-->
                <apex:column value="{!}"/>       
                <apex:column value="{!MKT.Product}"/>
                <apex:column value="{!MKT.Item}"/>
                <apex:column headerValue="Quantity">
                    <apex:inputText value="{!MKT.quantity}"/>



Apex Class
public with sharing class testWrapper
    public List<Materials__c> Materials {get;set;} 
    public List<materialWrapper> materialWrapperList {get;set;} 
    public testWrapper()
        materialWrapperList = new List<materialWrapper>();
        Materials = [select ID,name,Product__c, Item__c,Quanity__c, Active__c from Materials__c where Active__c =true limit 10];
        for(Materials__c obj : Materials)
            materialWrapper tempObj= new materialWrapper();
            tempObj.recordId =;
            tempObj.product = obj.Product__c;
            tempObj.item = obj.Item__c;
            tempObj.quantity = obj.Quanity__c;
            tempObj.selectB = false;

    //save method
    public void save()
        list<Materials_Junction__c> recordToInsert = new list<Materials_Junction__c>();
        for(materialWrapper obj : materialWrapperList)
         Materials_Junction__c temp ;
            if(obj.selectB == true)
                temp = new Materials_Junction__c();
                temp.sales_and_marketing__c = 'a032000000VQaRT';
                temp.Materials__C= obj.recordId;
                temp.quantity__C = obj.quantity; 
            //recordToInsert.add(temp); you are adding element outside the if condition that the reason for save button error
        insert recordToInsert;        
    public class materialWrapper
        public string recordId {get; set;}
        public string name {get; set;}
        public string product {get; set;}
        public string item {get; set;}
        public Decimal quantity {get; set;}
        public boolean selectB {get; set;}
        public void materialWrapper()
            recordId = '';
            name = '';
            product = '';
            item = '';
            quantity = 0.0;
            selectB = false;

SandhyaSandhya (Salesforce Developers) 
Hi Daniel Mason,

You can see the Visual Force pages which have the only standard controller in the dropdown list.

So to see your Visualforce page you need to have a standard controller with an extension like below.Use your controller testWrapper as an extension just change this line in above and make changes accordingly.
<apex:page standardController="Materials__c" extensions="testWrapper">
Please refer below link.

Hope this helps you!

Thanks and Regards

Hi Daniel

you have add standaredcontroller  in vf page.
<apex:page standardController="Materials_Junction__c" extensions="testWrapper">

Daniel MasonDaniel Mason
Hi shweta, 

If you have 5mins if is possible if we can arrange a go to meeting to discuss ? as i am a little confused