You need to sign in to do that
Don't have an account?

quicksave issue in visualforce page
Hi
I am testing my visualforce & apex coding skills .
I have implemented a extension class with standard controller to mimic the functionality of SAVE , SAVE&NEW and QUICKSAVE.
a) when I click SAVE&NEW button is it possible to redirect to the same visualforce page, so the enduser can enter the input values again.
b) how to implement QUICKSAVE functionality
Pls help me out
Thanks
sheila
I am testing my visualforce & apex coding skills .
I have implemented a extension class with standard controller to mimic the functionality of SAVE , SAVE&NEW and QUICKSAVE.
public with sharing class MimicSaveQuickSave { ApexPages.StandardController sController; public MimicSaveQuickSave(ApexPages.StandardController stdcontroller) { sController=stdcontroller; } public PageReference saveAndNew() { sController.save(); PageReference pref=new PageReference('/003/o'); pref.setRedirect(true); return pref; } }
<apex:page standardController="Contact" extensions="MimicSaveQuickSave"> <apex:form > <apex:pageBlock title="My Content" mode="edit"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Save"/> <apex:commandButton action="{!QuickSave}" value="QuickSave"/> <apex:commandButton action="{!saveAndNew}" value="SaveAndNew"/> <apex:commandButton action="{!cancel}" value="cancel"/> </apex:pageBlockButtons> <apex:pageBlockSection title="My Content Section" columns="2"> <apex:inputField value="{!contact.firstname}"/> <apex:inputField value="{!contact.lastname}"/> </apex:pageBlockSection> </apex:pageBlock> </apex:form> </apex:page>The SAVE & SAVE&NEW is working but I am unable to code for QUICKSAVE
a) when I click SAVE&NEW button is it possible to redirect to the same visualforce page, so the enduser can enter the input values again.
b) how to implement QUICKSAVE functionality
Pls help me out
Thanks
sheila
Try the below code in your controller ,this will work as expected:
Here the saveAndNew will again redirect back to same vf page and the QuickSave will run as expected.
Thanks
Hope this will be helpful.
All Answers
Try like this :
Hope this helps you!
If my answer helps resolve your query, please mark it as the 'Best Answer' & upvote it to benefit others.
Thanks
Varaprasad
@For Salesforce Project Support: varaprasad4sfdc@gmail.com
Salesforce latest interview questions :
https://www.youtube.com/channel/UCOcam_Hb4KjeBdYJlJWV_ZA?sub_confirmation=1
Try the below code in your controller ,this will work as expected:
Here the saveAndNew will again redirect back to same vf page and the QuickSave will run as expected.
Thanks
Hope this will be helpful.
Call the same page after save with contact id, it will work for quick save.
I need to understand how to deal with metadata, so I will debug and check.
Thanks for sharing