I have a custom object with a Long Text Area field to store a string that may be longer than 255 characters.
The contents of this string often includes text that looks like a hyperlink, but is not intended to be used as such.
E.g. somewhere in the value will appear a domain.com string:
Bacon ipsum dolor sit amet ground round exercitation google.com do laboris ham hock. Elit dolore aute consectetur, labore tenderloin anim eiusmod drumstick in.
Which Salesforce will render as:
How can I prevent Salesforce from automatically creating hyperlinks for these?
It seems to happen anywhere the field is used on a page layout or directly bound to in Visualforce.
I did find in Visualforce I could wrap the field in the controller and bind to a string version rather than directly to the field. This prevented the hyperlinks from being created.
E.g.
public class BaconWrapper {
public Bacon__c bacon {get;set;}
// Bind to this.
public string BaconIpsum {
get {
return bacon.BaconIpsum__c;
}
}
public BaconWrapper(Bacon__c cBacon) {
this.bacon = cBacon;
}
}
Best Answer
Pending any better answers, I'm going to conclude that there isn't a built in way to avoid the automatic hyperlinking of Text Area fields. You'll need to manually wrap them in a class and expose the value via a string property, bind to an outputtext control, use a formula field, etc...
I've raised the idea: Make automatic hyper-linking on a Text Area field optional