You need to sign in to do that
Don't have an account?

Loading a custom tab programatically
I am trying to load a tab programatically, so far I use the url that I see when I click on the tab, but I want to make sure this is the correct way:
public PageReference GoToTab() { PageReference pageRef = new PageReference('/servlet/servlet.Integration?lid=01r800000003iF1&ic=1'); return pageRef; }
Will that also work in a deployed managed application at a customer's site?
Thanks
I'm not sure whether the tab id will be the same when deploying to another salesforce account (probably not since all object tabs end up being different) so you can't really rely on it. A better way would be to load up the Visualforce page that is the tab page:
public PageReference GoToTab() { PageReference pageRef = Page.myTabPage; return pageRef; }
I'm not sure that you can reference the tab directly.
All Answers
I'm currently trying to get a delete action to work correctly, and have been using this page. The author describes URLFOR and notes that it can be used for tabs:
http://salesforcesource.blogspot.com/search?updated-max=2009-01-02T14%3A33%3A00-05%3A00&max-results=1
[All that is to say, I haven't tried it]
I'm not sure whether the tab id will be the same when deploying to another salesforce account (probably not since all object tabs end up being different) so you can't really rely on it. A better way would be to load up the Visualforce page that is the tab page:
public PageReference GoToTab() { PageReference pageRef = Page.myTabPage; return pageRef; }
I'm not sure that you can reference the tab directly.
This code does redirect the user to the VisualForce page. However, the correct tab is not selected (the Home tab is). This is confusing for users. If anyone knows how to redirect to a specific VisualForce page with a certain Tab selected (I'm surprised it's not easy, since you can set up a Tab to show a specific VisualForce page), I'd appreciate.
If I find the solution myself first, I'll be sure to post it here. Thanks in advance.
Anyone with better solution? I am having similar issue. I would like to avoid using tab number.
thanks,
-rajesh