You need to sign in to do that
Don't have an account?
Denise Crosby
commandbutton action return to original page
Hello Salesforce exports,
Newbie question here. I have a VF page using a custom controller with a commandbutton navigating to the standard New Contact page. After the user saves a contact there, I need to return to my VF page with the data refreshed. I'm hoping there is a simple way to do this, but I haven't come up with anything yet. Help is greatly appreciated.
Newbie question here. I have a VF page using a custom controller with a commandbutton navigating to the standard New Contact page. After the user saves a contact there, I need to return to my VF page with the data refreshed. I'm hoping there is a simple way to do this, but I haven't come up with anything yet. Help is greatly appreciated.
<apex:commandButton value="New Contact" action="{!URLFOR($Action.Contact.NewContact)}" />
The real bad news is that the only solution if a VFP/Lex component for replacing the entire standard edition of your contact creation (difficult to do) just because you want your own custom "Save" button and your custom return.
I know very well the problem because I have had to recode the standard edition of the account just for this problem of URL hack on the save button.
If the layout for your contact is simple, you can use a free AppExchange tool for generating an entire VF page automatically from your standard layout but it is bad for your end users to get a VF page instead of the standard nice SF1 layout (perhaps) just for this problem of navigation after the save. You can change the graphic charter of this new VF page for a better illusion but the lookup component will be like the one used in Classics.
Sorry but the hack of the "Save" button is still a very big problem with SF1/Lex (possible but expensive).
Regards
Alain
All Answers
I am not a Salesforce export (not yet, nor import).
If you create a contact from a VP page with a standard controller Account, the command button will be like that:
<apex:commandButton value="New Contact" action="{!URLFOR($Action.Contact.NewContact,null,[saveURL='/apex/myVFPname?id=' + account.Id]) }" />
or just change the value for the id used for the return after the save.
<apex:commandButton value="New Contact" action="{!URLFOR($Action.Contact.NewContact,null,[saveURL='/apex/myVFPname?id=' + myObject.Id]) }" />
(the trick: keep the brackets).
Regards
Thanks for your witty response. Made me smile. I'll apologize in advance for the newbie follow up questions. My VF page is used as a global quick action only. How do I get the url of the page? Or is it just \apex\NewEvent? I hardcoded it with an event id that I know, but it doesn't work. After saving, it navigates to the contact that was created instead of back to the NewEvent VF page. Can you see anything I'm doing wrong with this code?
Thanks for helping
Is /apex/NewEvent the name of your vf page? If it is correct, that should work but there could be a problem with the controller and extension you are using.
Could you post the source code of your VF page (or at least the first line <apex:page> ?
Regards
The real bad news is that the only solution if a VFP/Lex component for replacing the entire standard edition of your contact creation (difficult to do) just because you want your own custom "Save" button and your custom return.
I know very well the problem because I have had to recode the standard edition of the account just for this problem of URL hack on the save button.
If the layout for your contact is simple, you can use a free AppExchange tool for generating an entire VF page automatically from your standard layout but it is bad for your end users to get a VF page instead of the standard nice SF1 layout (perhaps) just for this problem of navigation after the save. You can change the graphic charter of this new VF page for a better illusion but the lookup component will be like the one used in Classics.
Sorry but the hack of the "Save" button is still a very big problem with SF1/Lex (possible but expensive).
Regards
Alain
URL Hacking is not a good choice. In the most of the cases, the right choice is to create a visualforce.
It’s the best choice, but not the fastest choice.
To turn it fast, Dieffrei Tiepo de Quadros (Brazil) created a visualforce code generator:
https://visualforce-generator.herokuapp.com
http://dieffrei.com/en_US/salesforce-visualforce-code-generator/
https://developer.salesforce.com/forums/ForumsMain?id=9060G000000MPW6QAO