+ Start a Discussion
tofertektofertek 

HYPERLINK function field

I am having trouble displaying a simple hyperlink.  I have a custom object called "someobject".  it has a field called "some_url" of type Formula.  The formula is below.

 

 

HYPERLINK('http://www.google.com', 'google' , '_blank')

 

 

the field outputs "Text".

 

So i have a custom controller/visualforce page for someobject.  It has a public member var with an instance of someobject that gets referenced all over the page with no problems.  I try to add this:

 

 

<apex:outputText value="{!someobject.some_url__c}" />

 hoping to see a hyperlink that says "google".  Instead I get nothing.

 

Can someone lead me on the path here?  Much thanks.

 

Best Answer chosen by Admin (Salesforce Developers) 
tofertektofertek

Hi Suresh.  I discovered my problem.

 

It turns out those HYPERLINK Formula fields showed up properly on the detail page, but not my visual force edit page.  So what I did is used the Formula fields for the detail page, moving them into the appropriate section, and in the edit page i dynamically create a new link using the apex:outputLink

 

 

                <apex:inputField value="{!mii.My_Order_Number__c}">
                                    <apex:actionSupport event="onkeyup" rerender="theLink"/>
                </apex:inputField>

                <apex:outputLink value="http://www.siteToLookUpOrder.com:7077/_windowLabel=orderView&orderView_actionOverride=%2Fsearch%2FshowOrderAction&orderViewid={!mii.My_Order_Number__c}" 
                                 id="theLink" target="_blank" >View Order in My Site</apex:outputLink>

This gives me the functionality that I am looking for.

 

Thank you for all of your help here.

 

 

All Answers

DharmeshDharmesh

Try this

 

<apex:outputField value="{!someobject.some_url__c}" />
tofertektofertek

When I do that, I get a label that says "google", but no hyperlink.

 

It is in a pageBlockSectrion that is in a pageBlock that is in "edit" mode.  Dont know if that has anything to do with it.

SSRS2SSRS2

Try with this

 

 <apex:outputText value="{!someobject.some_url__c} escape="false"/>

 -Suresh

 

tofertektofertek

when i go to outputField to outputText, then add escape="false", i get nothing at all, no label, no value, no hyperlink.

 

using outputField, i get the label i assigned originally ("google"), but no link.  outputField has no "escape" feature.

tofertektofertek

Is there just an example in the tutorials/documentation somewhere as to how to use a formula custom object field with the HYPERLINK function?

SSRS2SSRS2

Hello tofertek 

  It's work in my environment can you create another formula field(formula type should be text) ant checkout it.Did you pass the id value for record?.

salesforce_useful_formula_fields.pdf

 

-Suresh

tofertektofertek

Hi Suresh.  I discovered my problem.

 

It turns out those HYPERLINK Formula fields showed up properly on the detail page, but not my visual force edit page.  So what I did is used the Formula fields for the detail page, moving them into the appropriate section, and in the edit page i dynamically create a new link using the apex:outputLink

 

 

                <apex:inputField value="{!mii.My_Order_Number__c}">
                                    <apex:actionSupport event="onkeyup" rerender="theLink"/>
                </apex:inputField>

                <apex:outputLink value="http://www.siteToLookUpOrder.com:7077/_windowLabel=orderView&orderView_actionOverride=%2Fsearch%2FshowOrderAction&orderViewid={!mii.My_Order_Number__c}" 
                                 id="theLink" target="_blank" >View Order in My Site</apex:outputLink>

This gives me the functionality that I am looking for.

 

Thank you for all of your help here.

 

 

This was selected as the best answer
manishamanisha

What I am trying to do is. I have a customer object named "Inventory" and then I have a custom field name "Invoice" which is a URL field. What I want to do is post a link in that field that will be do the document that is attached to the inventory record. I don't want my end users to see the link I want them to see just the name of the file. How can I do this?

Thank you,

 

Manisha