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
Sachin Sharma 3886Sachin Sharma 3886 

Save button extension

Hi Expertz,

I am working on some functionality that when even a user clicks on Save button a new VF form should comes up alogn with some differemnt fields.

Then when ever user click the OK button on the new VF page all the data should commit to Salesforce.

I don't have any clues for this that how to even start as i a newbie, Kinldy assists.

Thanks
Sachin Sharma
salesforce mesalesforce me

that's because you've overridden the Save command and it running it from your extension....where the only code is to perform the page redirect.  You'll need to write a save dml statement there before the redirect.
Muthuraj TMuthuraj T
Hi,

For this you have to develop wizard kind of page. You have to develop custom apex code and custom vf page to accomplish this.
Sachin Sharma 3886Sachin Sharma 3886
Hi Expertz,

Thanks for your responses, But i have one more issue with the same.

Using action method, I am able to save the Record data and able to navigate this to the new page, but when user navigate to the other page. I want to save the new page data as chlid record for the first page. but i not able to find the way in which i can carry the First page record ID to the second page.

Kindly help.

Thanks
Sachin.
Muthuraj TMuthuraj T
Hi,
After saving the first page record, you can redirect the page with Record Id and you can get Parent Id from there.

Ex:
public PageReference save(){
    Account acc = new Account();
    acc.Name = 'Account Name';
    Insert acc;
    PageReference ReturnPage = new PageReference('/CustomPage?parentid=' + acc.id);    return Returnpage;
}

Save method from first page should work like above and second page controller should get the parent id from the url and create child record.
Sachin Sharma 3886Sachin Sharma 3886
Thanks, Muthuraj.

but its not working in case of the Self Loopkup relation ship.

class code and VF page below...
VF Page-----------------------------
<apex:page standardcontroller="LazyEmployee__c" extensions="LazyEmployeeController">
<apex:form >
    <apex:pageBlock >    
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!Save}"/>                
            <apex:commandButton value="Cancel" action="{!Cancel}"  />            
        </apex:pageBlockButtons>
         <apex:pagemessages ></apex:pagemessages>
        <apex:pageBlockSection columns="2">
            <apex:inputfield value="{!LazyEmployee__c.Field_1__c}"/>
            <apex:inputfield value="{!LazyEmployee__c.Field_2__c}"/>
            <apex:inputfield value="{!LazyEmployee__c.LazyEmployee_SelfLookUp__c}"/>
            <apex:inputfield value="{!LazyEmployee__c.LazyEmployee_SelfLookUp_Parent__c}"/>
        </apex:pageBlockSection>     
    </apex:pageBlock>
</apex:form>
</apex:page>


And Class is ----------------------------------------------

​public    class LazyEmployeeController{
LazyEmployee__c obj;
     string str;
     public LazyEmployeeController (ApexPages.StandardController controller){
         this.obj= (LazyEmployee__c) Controller.getRecord();    
     }
     public PageReference Save() {        
             insert obj;  
             PageReference ReturnPage = new PageReference('/LazyEmpPage?parentID='+obj.id);    
             return ReturnPage ;
     }
}