2

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.

5
  • So do you just want to show plain text instead? Commented Jan 3, 2013 at 9:15
  • no i want to give some other link on thet instead of by default link of Master record.
    – Pankaj
    Commented Jan 3, 2013 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. Commented Jan 3, 2013 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
    Commented Jan 3, 2013 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
    Commented Feb 4, 2013 at 13:18

2 Answers 2

4

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!!!

3
  • 2
    Can you mark your own answer as accepted so it goes "off the radar" of unanswered questions? :)
    – eyescream
    Commented Feb 4, 2013 at 16:56
  • 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
    Commented Feb 5, 2013 at 7:57
  • 1
    okz will take care from next time
    – Pankaj
    Commented Feb 5, 2013 at 8:28
0

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).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .