problem adding custom button to list view





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ margin-bottom:0;
}







1















I want to add a custom button to the list view of Contacts but it is not working. I go to Object Manager... Contacts... Search Layouts... List View... Edit... Custom Buttons... add my button to the list of Selected Buttons. When I go back to Contacts, it does not appear. If I remove Standard Buttons by unchecking them, nothing changes. Any direction would be appreciated.



I'm using Lightning. enter image description here



enter image description hereenter image description here



public class createNewContactController_ext {
//variables for the student
private final Contact con;
private ApexPages.StandardController stdController;
String StudentRecordType = '0121H000001If0DQAS';


//variables for dependent spouse
public List<Contact> spsList {get;set;} //using list so that I don't have to declare each variable
public Integer rowNumsps{get;set;}
String DepedendentRecordType = '0121H000001If0IQAS';


//variables for dependent children
public List<Contact> depList {get;set;}
public Integer rowNum{get;set;}

//initialize
public createNewContactController_ext(ApexPages.StandardController stdController) {
this.con = (Contact)stdController.getRecord();
depList = new List<Contact>();
spsList = new List<Contact>();
}
//for inserting additional rows in dependent spouse table
public void insertRowsps(){
spsList.add(new Contact(recordTypeID=DepedendentRecordType));
}

//for deleting rows from dependent spouse table
public void delRowsps(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('indexsps'));
depList.remove(rowNumsps);
}

//for inserting additional rows in dependent children table
public void insertRow(){
depList.add(new Contact(recordTypeID=DepedendentRecordType));
}


//for deleting rows from dependent children table
public void delRow(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
depList.remove(rowNum);
}

//save the records
public PageReference save(){

//save the student
insert con;

//save the spouse
insert spsList;
for (Contact sps : spsList){
hed__Relationship__c spsrel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=sps.Id, hed__Type__c='Spouse');
insert spsrel;
}

//save the child dependents
insert depList;
for (Contact dep : depList){
hed__Relationship__c rel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=dep.Id, hed__Type__c='Child');
insert rel;
}

//redirect to the detail page of the student
PageReference redirectPage = new ApexPages.StandardController(con).view();
redirectPage.setRedirect(true);
redirectPage.getParameters().put('id',con.Id);
return redirectPage;
}

}


the vf page:



    <apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" >
<apex:pageBlock title="Student">
<apex:form >
<apex:pageBlockSection >
<apex:inputField value="{!Contact.FirstName}" />
<apex:inputField value="{!Contact.LastName}" />
<apex:inputField value="{!Contact.Email}" required="true" />
<apex:inputField value="{!Contact.Birthdate}" showDatePicker="true"/>
<apex:inputField value="{!Contact.Affiliated_Community__c}" />
<apex:inputField value="{!Contact.Beneficiary_Number__c}" />
<apex:inputField value="{!Contact.Birth_Place__c}" />
<apex:inputField value="{!Contact.Social_Insurance_Number__c}" />
<apex:inputField value="{!Contact.hed__Gender__c}" />
<apex:inputField value="{!Contact.Counselor__c}" />
<apex:inputField value="{!Contact.Permanent_Code__c}" />
<apex:inputField value="{!Contact.Facebook_Profile__c}" />
<apex:inputField value="{!Contact.Language_Preference__c}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Student Permanent Address">
<apex:inputField value="{!Contact.MailingStreet}" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
<apex:inputField value="{!Contact.MailingPostalCode}" label="Province" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
</apex:pageBlockSection>
<apex:pageBlock title="Dependent Spouse" >
<apex:variable var="rowNumsps" value="{!0}" />
<apex:pageBlockTable value="{!spsList}" var="spstable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRowsps}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!spstable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!spstable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!spstable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!spstable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!spstable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNumsps}" name="indexsps" />
</apex:commandLink>
<apex:variable var="rowNumsps" value="{!rowNumsps+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlock title="Dependent Children" >
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlockTable value="{!depList}" var="deptable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRow}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!deptable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!deptable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!deptable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!deptable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!deptable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNum}" name="index" />
</apex:commandLink>
<apex:variable var="rowNum" value="{!rowNum+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton value="save" action="{!save}" />
</apex:form>
</apex:pageBlock>
</apex:page>









share|improve this question

























  • It sounds like this might be a JavaScript button. Is that correct?

    – sfdcfox
    Jan 9 at 15:35











  • it's a list button pointing to a VF page. I added a screenshot of the button.

    – Michael C
    Jan 9 at 16:28






  • 1





    What Visualforce Page are you using? What do you specify for its standardController? Can you share the markup for that page? Specifically what we need to see is just your <apex:page> tag.

    – Adrian Larson
    Jan 9 at 16:29











  • And is the Visualforce page marked as available for the Lightning Experience?

    – David Reed
    Jan 9 at 16:32











  • Can you change the list view filter? The custom VF page list view button is not visible in "Recently Viewed " list view for some reason

    – Pranay Jaiswal
    Jan 9 at 16:45


















1















I want to add a custom button to the list view of Contacts but it is not working. I go to Object Manager... Contacts... Search Layouts... List View... Edit... Custom Buttons... add my button to the list of Selected Buttons. When I go back to Contacts, it does not appear. If I remove Standard Buttons by unchecking them, nothing changes. Any direction would be appreciated.



I'm using Lightning. enter image description here



enter image description hereenter image description here



public class createNewContactController_ext {
//variables for the student
private final Contact con;
private ApexPages.StandardController stdController;
String StudentRecordType = '0121H000001If0DQAS';


//variables for dependent spouse
public List<Contact> spsList {get;set;} //using list so that I don't have to declare each variable
public Integer rowNumsps{get;set;}
String DepedendentRecordType = '0121H000001If0IQAS';


//variables for dependent children
public List<Contact> depList {get;set;}
public Integer rowNum{get;set;}

//initialize
public createNewContactController_ext(ApexPages.StandardController stdController) {
this.con = (Contact)stdController.getRecord();
depList = new List<Contact>();
spsList = new List<Contact>();
}
//for inserting additional rows in dependent spouse table
public void insertRowsps(){
spsList.add(new Contact(recordTypeID=DepedendentRecordType));
}

//for deleting rows from dependent spouse table
public void delRowsps(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('indexsps'));
depList.remove(rowNumsps);
}

//for inserting additional rows in dependent children table
public void insertRow(){
depList.add(new Contact(recordTypeID=DepedendentRecordType));
}


//for deleting rows from dependent children table
public void delRow(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
depList.remove(rowNum);
}

//save the records
public PageReference save(){

//save the student
insert con;

//save the spouse
insert spsList;
for (Contact sps : spsList){
hed__Relationship__c spsrel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=sps.Id, hed__Type__c='Spouse');
insert spsrel;
}

//save the child dependents
insert depList;
for (Contact dep : depList){
hed__Relationship__c rel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=dep.Id, hed__Type__c='Child');
insert rel;
}

//redirect to the detail page of the student
PageReference redirectPage = new ApexPages.StandardController(con).view();
redirectPage.setRedirect(true);
redirectPage.getParameters().put('id',con.Id);
return redirectPage;
}

}


the vf page:



    <apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" >
<apex:pageBlock title="Student">
<apex:form >
<apex:pageBlockSection >
<apex:inputField value="{!Contact.FirstName}" />
<apex:inputField value="{!Contact.LastName}" />
<apex:inputField value="{!Contact.Email}" required="true" />
<apex:inputField value="{!Contact.Birthdate}" showDatePicker="true"/>
<apex:inputField value="{!Contact.Affiliated_Community__c}" />
<apex:inputField value="{!Contact.Beneficiary_Number__c}" />
<apex:inputField value="{!Contact.Birth_Place__c}" />
<apex:inputField value="{!Contact.Social_Insurance_Number__c}" />
<apex:inputField value="{!Contact.hed__Gender__c}" />
<apex:inputField value="{!Contact.Counselor__c}" />
<apex:inputField value="{!Contact.Permanent_Code__c}" />
<apex:inputField value="{!Contact.Facebook_Profile__c}" />
<apex:inputField value="{!Contact.Language_Preference__c}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Student Permanent Address">
<apex:inputField value="{!Contact.MailingStreet}" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
<apex:inputField value="{!Contact.MailingPostalCode}" label="Province" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
</apex:pageBlockSection>
<apex:pageBlock title="Dependent Spouse" >
<apex:variable var="rowNumsps" value="{!0}" />
<apex:pageBlockTable value="{!spsList}" var="spstable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRowsps}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!spstable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!spstable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!spstable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!spstable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!spstable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNumsps}" name="indexsps" />
</apex:commandLink>
<apex:variable var="rowNumsps" value="{!rowNumsps+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlock title="Dependent Children" >
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlockTable value="{!depList}" var="deptable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRow}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!deptable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!deptable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!deptable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!deptable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!deptable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNum}" name="index" />
</apex:commandLink>
<apex:variable var="rowNum" value="{!rowNum+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton value="save" action="{!save}" />
</apex:form>
</apex:pageBlock>
</apex:page>









share|improve this question

























  • It sounds like this might be a JavaScript button. Is that correct?

    – sfdcfox
    Jan 9 at 15:35











  • it's a list button pointing to a VF page. I added a screenshot of the button.

    – Michael C
    Jan 9 at 16:28






  • 1





    What Visualforce Page are you using? What do you specify for its standardController? Can you share the markup for that page? Specifically what we need to see is just your <apex:page> tag.

    – Adrian Larson
    Jan 9 at 16:29











  • And is the Visualforce page marked as available for the Lightning Experience?

    – David Reed
    Jan 9 at 16:32











  • Can you change the list view filter? The custom VF page list view button is not visible in "Recently Viewed " list view for some reason

    – Pranay Jaiswal
    Jan 9 at 16:45














1












1








1








I want to add a custom button to the list view of Contacts but it is not working. I go to Object Manager... Contacts... Search Layouts... List View... Edit... Custom Buttons... add my button to the list of Selected Buttons. When I go back to Contacts, it does not appear. If I remove Standard Buttons by unchecking them, nothing changes. Any direction would be appreciated.



I'm using Lightning. enter image description here



enter image description hereenter image description here



public class createNewContactController_ext {
//variables for the student
private final Contact con;
private ApexPages.StandardController stdController;
String StudentRecordType = '0121H000001If0DQAS';


//variables for dependent spouse
public List<Contact> spsList {get;set;} //using list so that I don't have to declare each variable
public Integer rowNumsps{get;set;}
String DepedendentRecordType = '0121H000001If0IQAS';


//variables for dependent children
public List<Contact> depList {get;set;}
public Integer rowNum{get;set;}

//initialize
public createNewContactController_ext(ApexPages.StandardController stdController) {
this.con = (Contact)stdController.getRecord();
depList = new List<Contact>();
spsList = new List<Contact>();
}
//for inserting additional rows in dependent spouse table
public void insertRowsps(){
spsList.add(new Contact(recordTypeID=DepedendentRecordType));
}

//for deleting rows from dependent spouse table
public void delRowsps(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('indexsps'));
depList.remove(rowNumsps);
}

//for inserting additional rows in dependent children table
public void insertRow(){
depList.add(new Contact(recordTypeID=DepedendentRecordType));
}


//for deleting rows from dependent children table
public void delRow(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
depList.remove(rowNum);
}

//save the records
public PageReference save(){

//save the student
insert con;

//save the spouse
insert spsList;
for (Contact sps : spsList){
hed__Relationship__c spsrel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=sps.Id, hed__Type__c='Spouse');
insert spsrel;
}

//save the child dependents
insert depList;
for (Contact dep : depList){
hed__Relationship__c rel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=dep.Id, hed__Type__c='Child');
insert rel;
}

//redirect to the detail page of the student
PageReference redirectPage = new ApexPages.StandardController(con).view();
redirectPage.setRedirect(true);
redirectPage.getParameters().put('id',con.Id);
return redirectPage;
}

}


the vf page:



    <apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" >
<apex:pageBlock title="Student">
<apex:form >
<apex:pageBlockSection >
<apex:inputField value="{!Contact.FirstName}" />
<apex:inputField value="{!Contact.LastName}" />
<apex:inputField value="{!Contact.Email}" required="true" />
<apex:inputField value="{!Contact.Birthdate}" showDatePicker="true"/>
<apex:inputField value="{!Contact.Affiliated_Community__c}" />
<apex:inputField value="{!Contact.Beneficiary_Number__c}" />
<apex:inputField value="{!Contact.Birth_Place__c}" />
<apex:inputField value="{!Contact.Social_Insurance_Number__c}" />
<apex:inputField value="{!Contact.hed__Gender__c}" />
<apex:inputField value="{!Contact.Counselor__c}" />
<apex:inputField value="{!Contact.Permanent_Code__c}" />
<apex:inputField value="{!Contact.Facebook_Profile__c}" />
<apex:inputField value="{!Contact.Language_Preference__c}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Student Permanent Address">
<apex:inputField value="{!Contact.MailingStreet}" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
<apex:inputField value="{!Contact.MailingPostalCode}" label="Province" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
</apex:pageBlockSection>
<apex:pageBlock title="Dependent Spouse" >
<apex:variable var="rowNumsps" value="{!0}" />
<apex:pageBlockTable value="{!spsList}" var="spstable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRowsps}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!spstable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!spstable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!spstable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!spstable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!spstable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNumsps}" name="indexsps" />
</apex:commandLink>
<apex:variable var="rowNumsps" value="{!rowNumsps+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlock title="Dependent Children" >
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlockTable value="{!depList}" var="deptable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRow}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!deptable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!deptable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!deptable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!deptable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!deptable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNum}" name="index" />
</apex:commandLink>
<apex:variable var="rowNum" value="{!rowNum+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton value="save" action="{!save}" />
</apex:form>
</apex:pageBlock>
</apex:page>









share|improve this question
















I want to add a custom button to the list view of Contacts but it is not working. I go to Object Manager... Contacts... Search Layouts... List View... Edit... Custom Buttons... add my button to the list of Selected Buttons. When I go back to Contacts, it does not appear. If I remove Standard Buttons by unchecking them, nothing changes. Any direction would be appreciated.



I'm using Lightning. enter image description here



enter image description hereenter image description here



public class createNewContactController_ext {
//variables for the student
private final Contact con;
private ApexPages.StandardController stdController;
String StudentRecordType = '0121H000001If0DQAS';


//variables for dependent spouse
public List<Contact> spsList {get;set;} //using list so that I don't have to declare each variable
public Integer rowNumsps{get;set;}
String DepedendentRecordType = '0121H000001If0IQAS';


//variables for dependent children
public List<Contact> depList {get;set;}
public Integer rowNum{get;set;}

//initialize
public createNewContactController_ext(ApexPages.StandardController stdController) {
this.con = (Contact)stdController.getRecord();
depList = new List<Contact>();
spsList = new List<Contact>();
}
//for inserting additional rows in dependent spouse table
public void insertRowsps(){
spsList.add(new Contact(recordTypeID=DepedendentRecordType));
}

//for deleting rows from dependent spouse table
public void delRowsps(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('indexsps'));
depList.remove(rowNumsps);
}

//for inserting additional rows in dependent children table
public void insertRow(){
depList.add(new Contact(recordTypeID=DepedendentRecordType));
}


//for deleting rows from dependent children table
public void delRow(){
rowNum = Integer.valueOf(apexpages.currentpage().getparameters().get('index'));
depList.remove(rowNum);
}

//save the records
public PageReference save(){

//save the student
insert con;

//save the spouse
insert spsList;
for (Contact sps : spsList){
hed__Relationship__c spsrel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=sps.Id, hed__Type__c='Spouse');
insert spsrel;
}

//save the child dependents
insert depList;
for (Contact dep : depList){
hed__Relationship__c rel = new hed__Relationship__c(hed__Contact__c=con.Id, hed__RelatedContact__c=dep.Id, hed__Type__c='Child');
insert rel;
}

//redirect to the detail page of the student
PageReference redirectPage = new ApexPages.StandardController(con).view();
redirectPage.setRedirect(true);
redirectPage.getParameters().put('id',con.Id);
return redirectPage;
}

}


the vf page:



    <apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" >
<apex:pageBlock title="Student">
<apex:form >
<apex:pageBlockSection >
<apex:inputField value="{!Contact.FirstName}" />
<apex:inputField value="{!Contact.LastName}" />
<apex:inputField value="{!Contact.Email}" required="true" />
<apex:inputField value="{!Contact.Birthdate}" showDatePicker="true"/>
<apex:inputField value="{!Contact.Affiliated_Community__c}" />
<apex:inputField value="{!Contact.Beneficiary_Number__c}" />
<apex:inputField value="{!Contact.Birth_Place__c}" />
<apex:inputField value="{!Contact.Social_Insurance_Number__c}" />
<apex:inputField value="{!Contact.hed__Gender__c}" />
<apex:inputField value="{!Contact.Counselor__c}" />
<apex:inputField value="{!Contact.Permanent_Code__c}" />
<apex:inputField value="{!Contact.Facebook_Profile__c}" />
<apex:inputField value="{!Contact.Language_Preference__c}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Student Permanent Address">
<apex:inputField value="{!Contact.MailingStreet}" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
<apex:inputField value="{!Contact.MailingPostalCode}" label="Province" />
<apex:inputField value="{!Contact.MailingCity}" />
<apex:inputField value="{!Contact.MailingState}" />
</apex:pageBlockSection>
<apex:pageBlock title="Dependent Spouse" >
<apex:variable var="rowNumsps" value="{!0}" />
<apex:pageBlockTable value="{!spsList}" var="spstable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRowsps}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!spstable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!spstable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!spstable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!spstable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!spstable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNumsps}" name="indexsps" />
</apex:commandLink>
<apex:variable var="rowNumsps" value="{!rowNumsps+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlock title="Dependent Children" >
<apex:variable var="rowNum" value="{!0}" />
<apex:pageBlockTable value="{!depList}" var="deptable">
<apex:facet name="footer">
<apex:commandLink value="Add" action="{!insertRow}"/>
</apex:facet>
<apex:column headerValue="First Name">
<apex:inputField value="{!deptable.FirstName}"/>
</apex:column>
<apex:column headerValue="Last Name">
<apex:inputText value="{!deptable.LastName}"/>
</apex:column>
<apex:column headerValue="Birthdate">
<apex:inputField value="{!deptable.Birthdate}"/>
</apex:column>
<apex:column headerValue="Beneficiary Number">
<apex:inputField value="{!deptable.Beneficiary_Number__c}"/>
</apex:column>
<apex:column headerValue="Social Insurance Number">
<apex:inputField value="{!deptable.Social_Insurance_Number__c}"/>
</apex:column>
<apex:column headerValue="Delete" >
<apex:commandLink style="font-size:15px; font-weight:bold; text-align:center;color:red;" value="X" action="{!delRow}">
<apex:param value="{!rowNum}" name="index" />
</apex:commandLink>
<apex:variable var="rowNum" value="{!rowNum+1}"/>
</apex:column>
</apex:pageBlockTable>
</apex:pageBlock>
<apex:commandButton value="save" action="{!save}" />
</apex:form>
</apex:pageBlock>
</apex:page>






search-layout






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 9 at 19:08







Michael C

















asked Jan 9 at 15:27









Michael CMichael C

84




84













  • It sounds like this might be a JavaScript button. Is that correct?

    – sfdcfox
    Jan 9 at 15:35











  • it's a list button pointing to a VF page. I added a screenshot of the button.

    – Michael C
    Jan 9 at 16:28






  • 1





    What Visualforce Page are you using? What do you specify for its standardController? Can you share the markup for that page? Specifically what we need to see is just your <apex:page> tag.

    – Adrian Larson
    Jan 9 at 16:29











  • And is the Visualforce page marked as available for the Lightning Experience?

    – David Reed
    Jan 9 at 16:32











  • Can you change the list view filter? The custom VF page list view button is not visible in "Recently Viewed " list view for some reason

    – Pranay Jaiswal
    Jan 9 at 16:45



















  • It sounds like this might be a JavaScript button. Is that correct?

    – sfdcfox
    Jan 9 at 15:35











  • it's a list button pointing to a VF page. I added a screenshot of the button.

    – Michael C
    Jan 9 at 16:28






  • 1





    What Visualforce Page are you using? What do you specify for its standardController? Can you share the markup for that page? Specifically what we need to see is just your <apex:page> tag.

    – Adrian Larson
    Jan 9 at 16:29











  • And is the Visualforce page marked as available for the Lightning Experience?

    – David Reed
    Jan 9 at 16:32











  • Can you change the list view filter? The custom VF page list view button is not visible in "Recently Viewed " list view for some reason

    – Pranay Jaiswal
    Jan 9 at 16:45

















It sounds like this might be a JavaScript button. Is that correct?

– sfdcfox
Jan 9 at 15:35





It sounds like this might be a JavaScript button. Is that correct?

– sfdcfox
Jan 9 at 15:35













it's a list button pointing to a VF page. I added a screenshot of the button.

– Michael C
Jan 9 at 16:28





it's a list button pointing to a VF page. I added a screenshot of the button.

– Michael C
Jan 9 at 16:28




1




1





What Visualforce Page are you using? What do you specify for its standardController? Can you share the markup for that page? Specifically what we need to see is just your <apex:page> tag.

– Adrian Larson
Jan 9 at 16:29





What Visualforce Page are you using? What do you specify for its standardController? Can you share the markup for that page? Specifically what we need to see is just your <apex:page> tag.

– Adrian Larson
Jan 9 at 16:29













And is the Visualforce page marked as available for the Lightning Experience?

– David Reed
Jan 9 at 16:32





And is the Visualforce page marked as available for the Lightning Experience?

– David Reed
Jan 9 at 16:32













Can you change the list view filter? The custom VF page list view button is not visible in "Recently Viewed " list view for some reason

– Pranay Jaiswal
Jan 9 at 16:45





Can you change the list view filter? The custom VF page list view button is not visible in "Recently Viewed " list view for some reason

– Pranay Jaiswal
Jan 9 at 16:45










2 Answers
2






active

oldest

votes


















2














You have to use recordSetVar to add a button to List view. Adding recordSetVar makes it a StandardSetController and thus makes it available in that picklist to select.



<apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" recordSetVar="contacts">



Also, The list view VF page button won't be visible in "Recently Viewed" List view, you have to select any other listview to see that button.



EDIT:



Your apex Extension should be StandardSetController extension as well. StandardSetControllerExtension works on Set of records.



public class createNewContactController_ext {

public createNewContactController_ext(ApexPages.StandardSetController controller){
// constructor logic
}
}


NOTE: StandardSetController allows you to use the page in a List Button, whereas using a StandardController allows you to use it in a Detail Button.



Once you save your VF Page and Apex Class, It will be visible for you to add to Listview.



Src : https://salesforce.stackexchange.com/a/144831






share|improve this answer


























  • this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

    – Michael C
    Jan 9 at 18:40











  • even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

    – Michael C
    Jan 9 at 18:42











  • @MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

    – Pranay Jaiswal
    Jan 9 at 19:01











  • @MichaelC added logic with explanation

    – Pranay Jaiswal
    Jan 9 at 19:17











  • Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

    – Michael C
    Jan 9 at 19:31



















3














In order to use your page as list button, you need to use standard list controller instead of standard controller like this:



   <apex:page standardController="Contact" recordSetVar="conList" extensions="createNewContactController_ext">


Refer to below link for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm






share|improve this answer
























  • I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

    – Michael C
    Jan 9 at 17:47












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "459"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f246030%2fproblem-adding-custom-button-to-list-view%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























2 Answers
2






active

oldest

votes








2 Answers
2






active

oldest

votes









active

oldest

votes






active

oldest

votes









2














You have to use recordSetVar to add a button to List view. Adding recordSetVar makes it a StandardSetController and thus makes it available in that picklist to select.



<apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" recordSetVar="contacts">



Also, The list view VF page button won't be visible in "Recently Viewed" List view, you have to select any other listview to see that button.



EDIT:



Your apex Extension should be StandardSetController extension as well. StandardSetControllerExtension works on Set of records.



public class createNewContactController_ext {

public createNewContactController_ext(ApexPages.StandardSetController controller){
// constructor logic
}
}


NOTE: StandardSetController allows you to use the page in a List Button, whereas using a StandardController allows you to use it in a Detail Button.



Once you save your VF Page and Apex Class, It will be visible for you to add to Listview.



Src : https://salesforce.stackexchange.com/a/144831






share|improve this answer


























  • this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

    – Michael C
    Jan 9 at 18:40











  • even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

    – Michael C
    Jan 9 at 18:42











  • @MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

    – Pranay Jaiswal
    Jan 9 at 19:01











  • @MichaelC added logic with explanation

    – Pranay Jaiswal
    Jan 9 at 19:17











  • Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

    – Michael C
    Jan 9 at 19:31
















2














You have to use recordSetVar to add a button to List view. Adding recordSetVar makes it a StandardSetController and thus makes it available in that picklist to select.



<apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" recordSetVar="contacts">



Also, The list view VF page button won't be visible in "Recently Viewed" List view, you have to select any other listview to see that button.



EDIT:



Your apex Extension should be StandardSetController extension as well. StandardSetControllerExtension works on Set of records.



public class createNewContactController_ext {

public createNewContactController_ext(ApexPages.StandardSetController controller){
// constructor logic
}
}


NOTE: StandardSetController allows you to use the page in a List Button, whereas using a StandardController allows you to use it in a Detail Button.



Once you save your VF Page and Apex Class, It will be visible for you to add to Listview.



Src : https://salesforce.stackexchange.com/a/144831






share|improve this answer


























  • this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

    – Michael C
    Jan 9 at 18:40











  • even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

    – Michael C
    Jan 9 at 18:42











  • @MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

    – Pranay Jaiswal
    Jan 9 at 19:01











  • @MichaelC added logic with explanation

    – Pranay Jaiswal
    Jan 9 at 19:17











  • Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

    – Michael C
    Jan 9 at 19:31














2












2








2







You have to use recordSetVar to add a button to List view. Adding recordSetVar makes it a StandardSetController and thus makes it available in that picklist to select.



<apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" recordSetVar="contacts">



Also, The list view VF page button won't be visible in "Recently Viewed" List view, you have to select any other listview to see that button.



EDIT:



Your apex Extension should be StandardSetController extension as well. StandardSetControllerExtension works on Set of records.



public class createNewContactController_ext {

public createNewContactController_ext(ApexPages.StandardSetController controller){
// constructor logic
}
}


NOTE: StandardSetController allows you to use the page in a List Button, whereas using a StandardController allows you to use it in a Detail Button.



Once you save your VF Page and Apex Class, It will be visible for you to add to Listview.



Src : https://salesforce.stackexchange.com/a/144831






share|improve this answer















You have to use recordSetVar to add a button to List view. Adding recordSetVar makes it a StandardSetController and thus makes it available in that picklist to select.



<apex:page standardController="Contact" extensions="createNewContactController_ext" docType="html-5.0" recordSetVar="contacts">



Also, The list view VF page button won't be visible in "Recently Viewed" List view, you have to select any other listview to see that button.



EDIT:



Your apex Extension should be StandardSetController extension as well. StandardSetControllerExtension works on Set of records.



public class createNewContactController_ext {

public createNewContactController_ext(ApexPages.StandardSetController controller){
// constructor logic
}
}


NOTE: StandardSetController allows you to use the page in a List Button, whereas using a StandardController allows you to use it in a Detail Button.



Once you save your VF Page and Apex Class, It will be visible for you to add to Listview.



Src : https://salesforce.stackexchange.com/a/144831







share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 9 at 19:17

























answered Jan 9 at 17:00









Pranay JaiswalPranay Jaiswal

18.6k53158




18.6k53158













  • this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

    – Michael C
    Jan 9 at 18:40











  • even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

    – Michael C
    Jan 9 at 18:42











  • @MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

    – Pranay Jaiswal
    Jan 9 at 19:01











  • @MichaelC added logic with explanation

    – Pranay Jaiswal
    Jan 9 at 19:17











  • Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

    – Michael C
    Jan 9 at 19:31



















  • this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

    – Michael C
    Jan 9 at 18:40











  • even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

    – Michael C
    Jan 9 at 18:42











  • @MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

    – Pranay Jaiswal
    Jan 9 at 19:01











  • @MichaelC added logic with explanation

    – Pranay Jaiswal
    Jan 9 at 19:17











  • Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

    – Michael C
    Jan 9 at 19:31

















this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

– Michael C
Jan 9 at 18:40





this gives me the error: Unknown constructor 'createNewContactController_ext.createNewContactController_ext(ApexPages.StandardSetController controller)'

– Michael C
Jan 9 at 18:40













even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

– Michael C
Jan 9 at 18:42





even if I create a new button Display Type = List Button and Content Source = URL, the button does not display in the Contacts list page

– Michael C
Jan 9 at 18:42













@MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

– Pranay Jaiswal
Jan 9 at 19:01





@MichaelC can you post your apex code? Your Apex code in Extension should have StandardSetController as the constructor

– Pranay Jaiswal
Jan 9 at 19:01













@MichaelC added logic with explanation

– Pranay Jaiswal
Jan 9 at 19:17





@MichaelC added logic with explanation

– Pranay Jaiswal
Jan 9 at 19:17













Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

– Michael C
Jan 9 at 19:31





Thanks, that makes sense. However, the page will not be handling record sets but only a single record. The purpose of the page is the create records in multiple objects at the same time. So I'd like a button next to the New button that links to this VF page. I'm guessing that my inability to add a button next to the New (or somewhere in that section) has something to do with Search Layouts. Even if I add a generic, URL link button, it doesn't show up there.

– Michael C
Jan 9 at 19:31













3














In order to use your page as list button, you need to use standard list controller instead of standard controller like this:



   <apex:page standardController="Contact" recordSetVar="conList" extensions="createNewContactController_ext">


Refer to below link for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm






share|improve this answer
























  • I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

    – Michael C
    Jan 9 at 17:47
















3














In order to use your page as list button, you need to use standard list controller instead of standard controller like this:



   <apex:page standardController="Contact" recordSetVar="conList" extensions="createNewContactController_ext">


Refer to below link for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm






share|improve this answer
























  • I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

    – Michael C
    Jan 9 at 17:47














3












3








3







In order to use your page as list button, you need to use standard list controller instead of standard controller like this:



   <apex:page standardController="Contact" recordSetVar="conList" extensions="createNewContactController_ext">


Refer to below link for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm






share|improve this answer













In order to use your page as list button, you need to use standard list controller instead of standard controller like this:



   <apex:page standardController="Contact" recordSetVar="conList" extensions="createNewContactController_ext">


Refer to below link for more details:
https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_custom_button.htm







share|improve this answer












share|improve this answer



share|improve this answer










answered Jan 9 at 16:57









Ankush DurejaAnkush Dureja

872516




872516













  • I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

    – Michael C
    Jan 9 at 17:47



















  • I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

    – Michael C
    Jan 9 at 17:47

















I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

– Michael C
Jan 9 at 17:47





I have followed all the steps in the link you sent, thanks. However, for Step 5, I want to add a custom button to Search Layouts... List View. This is the part that is not working for me.

– Michael C
Jan 9 at 17:47


















draft saved

draft discarded




















































Thanks for contributing an answer to Salesforce Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsalesforce.stackexchange.com%2fquestions%2f246030%2fproblem-adding-custom-button-to-list-view%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Bressuire

Cabo Verde

Gyllenstierna