function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Rajesh UnadkatRajesh Unadkat 

How to get url for visualforce tab? Will it also highlight correct tab?

I have created a tab called 'My Tab' that's linked to visualforce page /apex/MyVFPage. I can probably get url to this page using PageReference and partial page logic for /apex/MyVFPage. However, is there any better way to the url, may be using tab name?

 

 

Shashikant SharmaShashikant Sharma

you can try with this, http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_calls_describetabs.htm

 

This is not an apex call, ir is api call. you can try this from java script and store url in any controller property and use that.

Ankit AroraAnkit Arora

Rajesh,

 

Would like to know what is your specific requirement to get the URL of tab from name. As "DescribeTabSetResult[] dtsrs = connection.describeTabs();" in javascript is good option but just wondering why going with long way to get URL if you can have it with "/apex/YOUR_PAGE_NAME".

 

 

Thanks

Ankit Arora

Blog | Facebook | Blog Page

Rajesh U.Rajesh U.

Thanks Ankit and Shashikant for the responses.

I would like to avoid using describeTabs on javascript side.

 

Here is my need,

I have a custom tab rendered using a VF page. When the tab is clicked, the VF page renders two pane layout. on left side, it renderes tree based ui for hierarchical objects; and on right side using <apex:detail> to render the selected object in tree node detail (I would like to use <Apex:detail> instead of writing my own detail renderer). Now when object is rendered with <apex:details>, it renderes standard buttons (I have not disabled them from page layout) such as edit. When user clicks on edit, it goes into normal SFDC object editing ui. The return url from this object detail editing brings user back into the tab vf page, but it does not correctly highlight my custom tab (because ret url is missing query parameter sfdc.tabName=01rA0000000i0QQ). Also, I have a need to add additional query parameter to tell my tab to select an object when rendered.

I hope this explains my use case, so now the questions are,

 

1. I know my tab url '/apex/vfMyTabPage?sfdc.tabName=01rA0000000i0QQ'. I can use the url as retURL hard coded along with passing whatever other query string parameters I need. however the tab name part may not be persistent across different orgs (of my customers). Because of this reason, I am looking for API that to retrieve tab url given my tab name or even apex vf page path.

 

2. The other related question - is there anyway to modify retURL of standard buttons such as edit (rendered by <apex:detail>? I can always try to hide standard button and render my buttons that could be managed.

 

 

thanks,

-rajesh

ram4SFDCram4SFDC

I have not come across the way to get the URL for the VF tab, but with the below work around you can make the tab selected when ever the VF page is loaded. 

On the apex:page component of your VF page give the value of the attribute tabStyle="My_Tab__tab".

this will display the tab as selected when ever the vf page related to tab is loaded.

 

 

MDV SuryaMDV Surya
Thanks ram4SFDC It worked for me to Highlight the Created Visualforce Tab.
KetZenKetZen
Hi Thanks for the solution. This really works. 

But in my case, my first page loads into a Home Page component, so when i highlight the custom tab using visualforce page, it loads in the same space. So my question is How do I open the next page using Tabstyle [as mentioned] in same window with the custom tab in standard header toolbar highlighted. Please advise.