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
kuldeep paliwalkuldeep paliwal 

i create an custom object with some custom fields on custom object i override the new button now how i save the record

public class NewDulplicateBusterJobController{

    private String BusterJobName;
    public String getBusterJobName() {
        return this.BusterJobName;
    public void setBusterJobName(String BusterJobName) {
        this.BusterJobName = BusterJobName;

    public NewDulplicateBusterJobController(ApexPages.StandardController controller) {
            selectedObject = 'account';

    public Map <String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
    public String selectedObject {get; set;}
    public SelectOption[] selectedFields { get; set; }
    public SelectOption[] allFields { get; set; }
    public String message { get; set; }

    Public NewDulplicateBusterJobController(){

    public List<SelectOption> getObjectNames(){
        List<SelectOption> objNames = new List<SelectOption>();
            for (Schema.SObjectType obj : schemaMap.values()){
                    Schema.DescribeSObjectResult describeSobject = obj.getDescribe();
                    String Name = describeSobject.getName();
                    String Label = describeSobject.getLabel();
                    if(Name == 'Account' || Name == 'Contact' || Name == 'Lead' || Name == 'Opportunity' || Name == 'Case' || Name == 'KnowledgeArticle' || describeSobject.isCustom()==true){
                        SelectOption so = new SelectOption( Name , Label );
                        system.debug('--objNames--' +objNames);
                        List<SelectOption> allFields = getObjectFields();
            return objNames;
    public List<SelectOption> getObjectFields(){
            selectedFields = new List<SelectOption>();
            Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
            Schema.SObjectType ObjectSchema = schemaMap.get(selectedObject);
            Map<String, Schema.SObjectField> fieldMap = ObjectSchema.getDescribe().fields.getMap();
            allFields = new List<SelectOption>();
            for (String fieldName: fieldMap.keySet()) {  
                    allFields.add(new SelectOption(fieldMap.get(fieldName).getDescribe().getName(),fieldMap.get(fieldName).getDescribe().getName()));
            return allFields;


<apex:page standardController="Buster_Job__c" extensions="NewDulplicateBusterJobController" > <apex:form > <apex:pageBlock title="Duplicate Filter Edit"> <apex:pageblockButtons location="top"> <apex:commandButton value="Save" /> <apex:commandButton value="Save & Start" /> <apex:commandButton value="Cancel"/> </apex:pageblockButtons> <apex:pageBlockSection title="Filter Name" collapsible="false" columns="2"> <apex:pageBlockSectionItem > <apex:outputLabel value="Buster Job Name:"></apex:outputLabel> <apex:inputText title="Buster Job Name" value="{!BusterJobName}" required="true"/> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Select Standard or Custom Object" columns="2"> <apex:pageBlockSectionItem > <apex:outputlabel value="Object:"/> <apex:actionRegion > <apex:selectList value="{!selectedObject}" size="1"> <apex:selectOptions value="{!ObjectNames}"/> <apex:actionSupport event="onchange" rerender="myFields"/> </apex:selectList> </apex:actionRegion> </apex:pageBlockSectionItem> </apex:pageBlockSection> <apex:pageBlockSection title="Select a Field and Its Rule"> <apex:pageblocksectionitem > <apex:outputPanel id="myFields"> <c:MultiselectPicklist leftLabel="Available Fields" leftOption="{!allFields}" rightLabel="Selected Fields" rightOption="{!selectedFields}" size="14" width="150px"/> </apex:outputpanel> </apex:pageblocksectionItem> </apex:pageblocksection> </apex:pageBlock> </apex:form> </apex:page>
Banwari kevat1Banwari kevat1
Hi kuldeep,
   For saving record, we have to specify action attribute for command button which will save our record. Standard apex controller contains a standard action '{!save}' . We can carry out an action for saving record using this standard action. You have to add an action attribute in command button in order to save a record as following:
<apex:commandButton value="Save"  action="{!save}"/>

kuldeep paliwalkuldeep paliwal
yes its i know but on controller what i have to add..can u check above code and appro. please share what exactly it would be...
Banwari kevat1Banwari kevat1
No need to change in controller just add action attribute in command button in visualforce page.
kuldeep paliwalkuldeep paliwal
i do that but nothing will happen