You need to sign in to do that
Don't have an account?
Return to salesforce instance from custom controller
Hi Guys,
I've a custom button, when it is clicked it creates new record in another custom object and the user is redirected to newly created record.
I use pagereference class to perform this logic. But when I redirect the user to the newly created record, user stays in the visualforce page instead of salesforce instance
i.e... User stays in this URL https:/INSTANCE.visual.force.com/apex/ConvertintoCustomer?scontrolCaching=1&id=a0LE00000001ChS
instead of
https://INSTANCE.salesforce.com/a0LE00000001ChS
How I can redirect user to the above URL instead of visual.force.com
Thanks,
Vamsi.
Hi,
You are in developer org and your user has enabled the development mode. That's why you were seeing the visualforce editor. If you don't see the editor you can disable from your user record.
YourName --> Setup --> ManageUser --> User --> Edit Your User record (You have to uncheck the "Development Mode" in user record)
OR
You can append following URL portion to your URL
It will hide the visualforce editor even your user has the development mode feature.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
All Answers
Hi Vamsi,
How are you using the page reference for redirection?
Hi Rahul,
Thanks for your quick response.
Here is the code.
newcon variable stores id of the newly created record.
Thanks,
Vamsi.
try this:
you have loaded pagereference with full url of salesforce, so just you need to use partial url.
remaining would be automatically genereted(prepended by server url)
Hope it helps.
Hi Rahul,
I've already tried your solution, but when it redirects, it stays in the visualforce page URL with
"visualforce pages development tools" footer (a ribbon on the bottom of the page with visualforce page and its custom controller) at the bottom of the page, and never goes to he main instance.
Again, Thank you for our tim.
Thanks,
Vamsi.
I didn't get the problem you are facing?
could you explain a bit.
I'm working in the developer edition, As I said if I click on the button, it redirects to the newly created record in the same window with the ribbon I pointed in the below image on the bottom of the page. and the URL will be https://na9.visual.force.com/apex/ConvertintoCustomer?id=a0LE00000001ChS&scontrolCaching=1 instead of https://na9.salesforce.com/a0LE00000001ChS.
Hello,
Are you redirecting the whole page or only the iFrame?
also try turning off the development .
Hi Rahul,
I'm not sure about redirecting the whole page or the iFrame. All i'm using is the redirect pagereference class.
Moreover I'm not sure turning off development.
I'll be glad if you could further explain me on this.
Thanks,
Vamsi.
just go to user detail page and you can find a check box there named as Development Mode ... uncheck the same
Hi,
You are in developer org and your user has enabled the development mode. That's why you were seeing the visualforce editor. If you don't see the editor you can disable from your user record.
YourName --> Setup --> ManageUser --> User --> Edit Your User record (You have to uncheck the "Development Mode" in user record)
OR
You can append following URL portion to your URL
It will hide the visualforce editor even your user has the development mode feature.
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Hi Chamil,
Thank you for your advice. I could able to test one of your solutions, if I uncheck the Development Mode in the user profile, it solved my requirement.
But, the second solution didn't worked for me, I think I'm not sure where I need to add it in the URL.
Here is how my return URL look like
Could you please suggest me where I need to add the code that you suggested in the above.
Thanks,
Vamsi.
Hi,
Append the url segment as follows;
If a reply to a post answers your question or resolves your problem, please mark it as the solution to the post so that others may benefit.
Chamil's Blog
HI Chamil,
For some reason, when the developer mode is checked, this solution is not working.
Thanks,
Vamsi.