+ Start a Discussion

Product - how to refer the action for standard button “Save & Add Price”

I had created a new VF page as like the page for editing the products which seems to work fine. I have a button 'Save' and 'Cancel' for which i have the action for the buttons as action="{!save}" and action="{!cancel}". though i do not have any codes at the controller for save and cancel the page is pretty much doing its job. so the question is:

does the action for save and cancel i have as below are standard actions for save and cancel?

<apex:commandButton action="{!save}" value="Save" /> <apex:commandButton action="{!Cancel}" value="Cancel"/>

in standard When creating a new product i see another button 'Save & Add price' which takes me to a subsequent screen to add the price. How can i get the action for 'Save & Add price' button so that i can use it in my controller in way from my custom VF page I can do the add price page directly?
Abhishek BansalAbhishek Bansal
Hi Prabhu,

Yes the Save and Cancel are the standard methods of standard controller so you do not have to write any method related to them in controller class but unfortunately there is no method available for "Save and Add Price" so you have to define your own method in controller class.

Please use the below method in your controller class to achieve your requirement :
public pageReference saveAndAddPrice(){
	return new pageReference('/pbk/addstandardPrice.jsp?id='+productId);
Please do no forget to replace productId with your id varibale of Product.

Let me know if you need more help on this.

Vishal Negandhi 16Vishal Negandhi 16
As per the documentation for the methods here : https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_std_actions.htm 
I couldn't find any specific method for Save and Add Price. I believe it's not supported. You may need to write a custom method for that.