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

Create a hyperlink using ID
Hi,
I wanted to know if i could create hyperlink to a particular record by just having id as information.
For example, if i did a SOQL query for ids of all accounts:
List<id> accids = [SELECT id FROM Accounts];
for (id accid :accids)
{
for each id i need to create a hyperlink and store it as a string.
then display it on VF page
}
The issue that not all orgs has the same starting URL?
Any suggestion?
Thanks
<apex:outputLink value="/{!acc.Id}">acc.Name</apex:outputLink>
All Answers
The relative URL will be '/recordID' you can generate that as
String URLString = '/'+recordID;
Based on using a Relative URL, I can show on the VF page the following:
Account 1 James Tom (by clicking on James Tom, it would take me to that account)
Account 2 Sarah Base
Account 3 Kist Three
etc
Thanks
<apex:outputLink value="/{!acc.Id}">acc.Name</apex:outputLink>