Take the 2-minute tour ×
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

I am displaying Lookup field value in apex:commanLink. but its link is navigating to the master record . i want to remove this link,How should i implement this?

Thanks in advance.

share|improve this question
    
So do you just want to show plain text instead? –  Andrew Fawcett Jan 3 '13 at 9:15
    
no i want to give some other link on thet instead of by default link of Master record. –  Pankaj Jan 3 '13 at 9:29
3  
I just noticed your using apex:commandLink, so the link will be to a method on your controller class. That method will be determining what happens when the user clicks the link. It may help to share some sample code in your question btw. –  Andrew Fawcett Jan 3 '13 at 10:09
    
Please consider including a snippet from your visualforce to help us understand what you're doing now and what you're trying to change. –  Benj Jan 3 '13 at 14:02
    
hi,where you are showing that look up value just show its name suppose your lookup field value is look__c so just use lookup__r.Name.definitely work!!! –  Pankaj Feb 4 '13 at 13:18
add comment

2 Answers

up vote 2 down vote accepted

The solution is to show Name field of the related object instead of just lookup field on the referencing one.

Supposing your lookup field API name is look__c - just use lookup__r.Name. Definitely works!!!

share|improve this answer
2  
Can you mark your own answer as accepted so it goes "off the radar" of unanswered questions? :) –  eyescream Feb 4 '13 at 16:56
1  
thanks a lot Tomasz for updating the answer. –  Pankaj Feb 5 '13 at 5:22
1  
It was listed in a review menu (system flags some too short answers as suspicious and at 1000+ you're expected to care about the site, fix simple code formatting or grammar problems). There was nothing wrong with the core of your answer, it's just a bit more readable and useful for whoever else has same problem :) –  eyescream Feb 5 '13 at 7:57
1  
okz will take care from next time –  Pankaj Feb 5 '13 at 8:28
add comment

If it's a simple link you are looking for use <apex:outputLink> instead. If you need to call a controller then stick with <apex:commandLink> but set the PageReference appropriately as the return value of your method (returning null should stop you navigating anywhere).

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.