+ Start a Discussion

create new account object on click of button in vf page and refresh my previous page


This looks simple but I am not able to figure out how to do it.I have a vf page with apex controller. URL hahs some parameters. On page load from the url I get the parent account and in a drop down display the parent and its direct children. Now if the child doesnt exist I craete a button 
<apex:commandbutton action="{!URLFOR($Action.Account.New, $ObjectType.Account)}" title="New Site" value="New Site" oncomplete="alert('hello');"> </apex:commandbutton> . It takes me to create account but how do I return back to my original page and refresh that dropdown or call the constructor to rerender.

Also tried  
<apex:commandLink value="Add Account" action="/001/e?retURL=/apex/est?id=a0JG000000Q3Dqg&accid=001G000001FrCLc&accname=Fremont+Senior+High" target="_blank"/>

The salesforce default beaviour after create it so to take to detail page so how do I overcome this.
Any help is appreciated.

You may need to go with controller extension to redirect to the actual Visual Force from where you redirected to new record creation page . Please review the solution at the link below which might help you understand this better http://salesforce.stackexchange.com/questions/3907/redirecting-back-to-original-page-using-visualforce