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

OutputField displaying as web link

Hey all,
I have the following code snippet in one of my pages:

<apex:pageBlockTable value="{!displayedIOs}" var="io">

<apex:column headerValue="BC" rendered="{!isBCD}"> <apex:outputField value="{!io.BC__c}"/> </apex:column></apex:pageBlockTable>

 So my column displays the name of a related object using this code. However, that name is a web link to the actual object. I would like to still display the name, but suppress the link part.
Using code like:
<apex:column headerValue="BC" rendered="{!isBCD}" value="{!io.BC__c}"/>

only displays the ID of the branded channel.
Given that I am iterating over a set in my pageBlockTable, I can't see a way around this. Does anyone know a way?
After a patch last week I would expect the value attribute on column to be identical to the embedded outputField example you posted.  Have you tried that recently?  I just want to verify.

outputField will display the way salesforce displays lookups, which is with the name of the object and a link to it.  If you want it to display differently, you will need to use outputText.

However in the case of lookups, the id is the value of the outputText. So you would have to do the formatting in your controller, and query for the name based on the id.  That's the only way around it that I know of.

Thanks for that Jill.

Yes the the value attribute now works the same as the outputField functionality.

I have resolved this by extending my query to retrieve the related object name, which allowed me to do something like:

<apex:column headerValue="BC" rendered="{!isBCD}" value="{!io.BC__r.Name}"/>

which just displays the name of the related object. Thanks for the help