Wednesday, 18 February 2015

How to overide standard salesforce save button?

Hi guys!

Yesterday, I was working on overiding the standard save and cancel button. I know there are many blogs you ll find easily on google.

Anyways, am just sharing just to add a simple way(I think , u may find more easier  :P:P) of overiding . Lets jump to scenario.

Scenario:-  Say, I have a custom visualforce page abc and from there I have given a button on that page. When that button is pressed, it should take us to standard edit page of account. After clicking the save button it should take us to custom visualforce page. lets say to xyz page.



So , you guys are aware of  URL parameters that are appended when you open standard detail page of account inedit mode it is like :-

https://na15.salesforce.com/001/e?retURL=%2F001%2Fo

So, what happen is after you fill the details. and hit save button. it takes you to the record itself . It is the standard salesforce  functionality.

Lets see what these parameters are meant for:-

1. 001 - it is id of account object.
2. 001/e?-  It stands for edit mode .
3. retURL - It is the url when you click the cancel button
4. saveURL - It is the URL for landing page.

So, my requirement is that I have to redirect from my custom visulforce page to account edit page.
to do this - in your page refrnce method append this

pagereference pr= new pagereference('/001/e?retURL=/apex/AccountSearch&saveURL=/apex/CreateContac').setRedirect(true);

Thanks
Ankush






No comments:

Post a Comment

oAuth Use Case -  Headless API Explained in the Easiest way Wondering why? and When we use the Headless API flow Use case example: Imagine a...