You need to sign in to do that
Don't have an account?
Slash in <apex:outputLink> syntax
Could someone explain why the slash "/' is required for the link to work in the example below?
When I use this code, the link does not work. I get an error: "The name '...' can only contain alphanumeric characters, must begin with a letter, and must be unique."
<apex:column headerValue="Contract Number">
<apex:outputLink value="{!c.Id}">{!c.ContractNumber}</apex:outputLink>
</apex:column>
However when I add the slash "/" everything works as expected. Is this documented somewhere? I have not found an explanation yet.
<apex:column headerValue="Contract Number">
<apex:outputLink value="/{!c.Id}">{!c.ContractNumber}</apex:outputLink>
</apex:column>
Its an output link where you want to get redirected to salesforce page.
Hence when you just specify "{!c.Id}" it does not tell you the URL.
While when you write "/{!c.Id}" it means take the URL of current salesforce instance and append the ID parameter.
Hence this would result in http://...salesforce instance/the record Id. and hence it opens the correct page for you.
All Answers
Its an output link where you want to get redirected to salesforce page.
Hence when you just specify "{!c.Id}" it does not tell you the URL.
While when you write "/{!c.Id}" it means take the URL of current salesforce instance and append the ID parameter.
Hence this would result in http://...salesforce instance/the record Id. and hence it opens the correct page for you.
Thank you for the explanation. It makes sense. It is what I observed in the URL.