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
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12 

How to remove the hyperlink in the ‘Lookup’ filed?

Hi

How to remove the hyperlink in the ‘Lookup’ filed for particular profile Name only. I have used the java script and get the Element ID to using the style in Java script, but I can't remove the Hyperlink in that Lookup field. Kindly share your knowledge about this.
 
My code : var x = document.getElementsById("lookupa05f0000006ljSZ00ND0000005EdfF").style.pointerevents="none";
 
Thanks in Advance 
Best Answer chosen by sundhar.mks1.3962649227519546E12
Himanshu ParasharHimanshu Parashar
Hi Sundhar,

You can remove this using jquery because you will get instance of id after page load.
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$( document ).ready(function() {
  var insidetext = $("#lookup0015000000qYxgmcon4").html(); //Get the innertext
  $("#lookup0015000000qYxgmcon4").parent().text(insidetext); //Replace href with text.
});
</script>


Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

All Answers

NagaNaga (Salesforce Developers) 
Hi Sundhar,

Please see if the below link which has the code helps you

http://stackoverflow.com/questions/9101678/removing-the-link-from-a-visualforce-lookup-field-output

Best Regards
Naga kiran
sandeep sankhlasandeep sankhla
Hi sundhar,

The solution is to use Name in output text instead if reference Id there...

Check the below post which can help you for the same..
http://stackoverflow.com/questions/9101678/removing-the-link-from-a-visualforce-lookup-field-output

http://salesforce.stackexchange.com/questions/5896/removing-look-up-field-link-in-visualforce-page

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.

Thanks,
Sandeep
Salesforce Certified Developer 
Himanshu ParasharHimanshu Parashar
Hi Sundhar,

You can remove this using jquery because you will get instance of id after page load.
 
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
<script>
$( document ).ready(function() {
  var insidetext = $("#lookup0015000000qYxgmcon4").html(); //Get the innertext
  $("#lookup0015000000qYxgmcon4").parent().text(insidetext); //Replace href with text.
});
</script>


Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
This was selected as the best answer
Himanshu ParasharHimanshu Parashar
Hi Sundhar,

I have added my lookup id in my sample code so you need to replace that with your lookup. I hope that should not be problem for you.

Thanks,
Himanshu
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12
Hi Himanshu,

Thanks for your Responce, Is this possible to without jquery? How to achive this in javascript?
 
Himanshu ParasharHimanshu Parashar
Hi Sundhar,

Please find equivalent javascript code
 
<script>
  var insidetext = document.getElementById("lookupa05f0000006ljSZ00ND0000005EdfF").innerText;
  document.getElementById("lookupa05f0000006ljSZ00ND0000005EdfF").parentNode.innerHTML=insidetext;
</script>

Thanks,
Himanshu
Salesforce Certified Developer | Administrator | Service Cloud Consultant

P.S. If my answer helps you to solve your problem please mark it as best answer. It will help other to find best answer.
 
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12
Hi  Himanshu,

Thanksyou so much, I have removed using  jquery
 
Rajkumar VenkatRajkumar Venkat
Option 1: Just adding to above threads if someone want to find out the column id dynamically below code might help.. This is for removing Oppty/Account lookup link to standard detail page.

<apex:page standardController="Quote" showHeader="false" sidebar="false"  id="quotePage">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> <script> $( document ).ready(function() { var accountid='{!Quote.AccountId}'; var oppid='{!Quote.OpportunityId}'; var insidetext = $("#lookup"+oppid.substring(0,15)+"quotePage_QuoteDetailOpportunity").html(); $("#lookup"+oppid.substring(0,15)+"quotePage_QuoteDetailOpportunity").parent().text(insidetext); var insidetext = $("#lookup"+accountid.substring(0,15)+"quotePage_QuoteDetailAccount").html(); $("#lookup"+accountid.substring(0,15)+"quotePage_QuoteDetailAccount").parent().text(insidetext); }); </script>
<apex:detail relatedList="false" title="true" id="QuoteDetail"/>

</apex:page>

Option 2: Formula fields(Oppty.Account.Name) or (Oppty.Name) is another option without any js code. but it will not works the field is required field in the standard layout(Oppty field is required in Quote Std Layout)