+ Start a Discussion
vamsi varmavamsi varma 

save and new action in visualforce

Hi,
i have a vf page, that is invoked when new contact button in account page is used.
in that vf page i have save and new button.
that button when we pressed it.
It should save and redirect to same vf page with account id same as previous one.
can anyone implement this and let me know.
thanks in advance,
Vamsi
Suraj PSuraj P
Pass the Account Id as a page Param going from the Account VF Page to the new Contact VF Page. Then, in the save and new button's action method on the new Contact page, put this code at the end

<pre>
PageReference pr = Page.AccountVFPage;
pr.getParameters().put(Id,'<AccountId>');
pr.setRedirect(true);
return pr;
</pre>
Krishna SambarajuKrishna Sambaraju
Hi Vamsi,

What is the reason for creating a custom visualforce page for creating new contact, when you can do it with the standard functionality on the Account page layout?

Regards,
Krishna.
vamsi varmavamsi varma

Krishna,
I want to skip recordtype selection page.
i have done that succesfully.
thanks suraj.
 

vamsi varmavamsi varma

i have one more question when this is done from account page layout it is going good.
but when i create new contact from contact tab , we dont have any kind of account .

but my intention is to select record type on account basis.

so if i select account there the vf page should refresh based on that.

can anyone help me on this issue....?
thanks in advance.
vamsi

Suraj PSuraj P
If my answer helped, please mark it as the best answer. Thanks