Hide Edit/Del Links on Salesforce Standard Page

It is not possible to control the visibility of the Edit/Del action links for a related list. On a VisualForce page you can insert your own CSS or Javascript to control the display, which you can also do on a Salesforce standard layout, albeit in a slightly more complicated fashion.

The trick is to use a Custom Link on your Home Page Layout. This Custom Link is defined as an onClick, but will actually load code inline with the use of REQUIRESCRIPT. Inside the REQUIRESCRIPT will be our Javascript payload, Base64 encoded.

Create Javascript Payload

First let’s compile the Javascript we need to control the UI on standard page layouts. In this case we want to hide the Edit/Del links on a related list, so view the page and use your developer tools to look at the DOM. You want to find the ID of the top level element in the related list table, something like “500c0000004BtmN_00sE0000004gkgq_body”. Use the following snippet as an example.

	// hide this sidebar module
	$('#sidebarDiv div.linksModule').each(function(){
		var $module = $(this);
		if ( $module.find('.brandPrimaryFgr').text()=='UserInterfaceInjection'){
			return false;
	// hide the Edit/Del links
	jQuery('#500c0000004BtmN_00sE0000004gkgq_body .actionColumn').hide();

Now we need to convert this to Base64. Any way is fine, but online is pretty easy: https://www.base64encode.org/.


Put this text aside, we will need it later when creating the Javascript link.

Create Custom Link

Visit Setup > Home > Customize > Custom Links

  1. Create a new Link
  2. Name: UserInterfaceInjection
  3. Behavior: Execute Javascript
  4. Content Source: onClick Javascript
  5. Body: {!REQUIRESCRIPT('data:application/javascript;base64,BASE64_JS')}, except that you want to replace BASE64_JS with your Base64 encoded Javascript.

Create Home Page Component

Visit Setup > Home > Home Page Components

  1. Create a new Component
  2. Name: UserInterfaceInjection
  3. Type: Links
  4. Choose UserInterfaceInjection Link

Add to Home Page Layout

Visit Setup > Home > Home Page Layouts

  1. Edit your layout to include UserInterfaceInjection

Now when you visit your page the Action column should be hidden from your related list. It’s pretty easy to see how this could be further expanded to add all kinds of custom functionality to standard Page Layouts in Salesforce.

You may also like...

10 Responses

  1. Garima Chaturvedi says:

    Hi Justin,
    Is this still working?


  2. eugene says:

    Good day! I’m trying to remove the “Submit for Approval” button using the above instruction, but I cant seem to make it work. Any help? Here is my jQuery:

    if(window.location.href.indexOf(“.com/0Q0”) != -1) {
    $j(document).ready(function() {

    • User Avatar Justin Silver says:

      Hi Eugene,

      Unfortunately this doesn’t seem to be working with the latest release of Salesforce – it’s also a bit moot if you can use Lightning.


  3. indira says:

    the custom link is not getting saved as we are getting syyntax error,

    • User Avatar Justin Silver says:

      Hi Indira,

      It’s hard to say what the problem might be without seeing your code. I can attest to this hack working when I wrote the article 🙂


    • User Avatar Justin Silver says:

      I just noticed that the single quotes in the textarea were being converted to weird characters which might have caused your syntax error. That said, just copying that code will not work as you need to specify the HTML/DOM ID for the related list you want to hide – this won’t remove them for all lists. Once you have done that you need to generate your own Base64 encoded version, then include it using REQUIRESCRIPT, and make sure that it is using single quotes.

    • User Avatar Justin Silver says:

      Upon further investigation, it looks like quite a few things have changed that make this post not valid. It’s still possible to use the Base64/Custom Link JavaScript injection, but jQuery isn’t available, etc so you will have to include it if you want to use it. This can be included in Home Page Layout easily, and on Detail pages, but Tab Home Pages will require a VisualForce page (in which case you could include the JavaScript directly).

      Here is some sample code I was playing around with if you want to try it:

      function hide_edit_del_links(){
      		// hide the Edit/Del links
      if (typeof jQuery == 'undefined'){
      	var script = document.createElement("script");
      	script.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js");
      	script.addEventListener('load', function(){
      	}, false);
      } else {

      I will write a new post with some updates soon.

  4. Apurva says:

    This somehow doesn’t seem to work for me. Do you have any other solution? Probably javascript or something? I am in urgent need for a solution to hide the edit/delete links on account related list.

    Pls help!

    • User Avatar Justin Silver says:


      Do you see any JavaScript errors, or does it must not work? Note that you can’t copy my code exactly, if you aren’t seeing any errors my guess is that you aren’t using the correct ID – you have to use the ID of the top level element of the table you want to hide the edit/del links on. If that doesn’t work you could try starting with just Base64 encoding “alert(‘hello world’);” to make sure you can run any JavaScript at all.

      Good luck!

Leave a Reply

Your email address will not be published. Required fields are marked *