Salesforce
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.
jQuery(document).ready(function($){
// hide this sidebar module
$('#sidebarDiv div.linksModule').each(function(){
var $module = $(this);
if ( $module.find('.brandPrimaryFgr').text()=='UserInterfaceInjection'){
$module.hide();
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/.
alF1ZXJ5KGRvY3VtZW50KS5yZWFkeShmdW5jdGlvbigkKXsNCgkvLyBoaWRlIHRoaXMgc2lkZWJhciBtb2R1bGUNCgkkKCcjc2lkZWJhckRpdiBkaXYubGlua3NNb2R1bGUnKS5lYWNoKGZ1bmN0aW9uKCl7DQoJCXZhciAkbW9kdWxlID0gJCh0aGlzKTsNCgkJaWYgKCAkbW9kdWxlLmZpbmQoJy5icmFuZFByaW1hcnlGZ3InKS50ZXh0KCk9PSdVc2VySW50ZXJmYWNlSW5qZWN0aW9uJyl7DQoJCQkkbW9kdWxlLmhpZGUoKTsNCgkJCXJldHVybiBmYWxzZTsNCgkJfQ0KCX0pOw0KCS8vIGhpZGUgdGhlIEVkaXQvRGVsIGxpbmtzDQoJalF1ZXJ5KCcjNTAwYzAwMDAwMDRCdG1OXzAwc0UwMDAwMDA0Z2tncV9ib2R5IC5hY3Rpb25Db2x1bW4nKS5oaWRlKCk7DQp9KTs=
Put this text aside, we will need it later when creating the Javascript link.
Create Custom Link
VisitSetup > Home > Customize > Custom Links
- Create a new Link
- Name:
UserInterfaceInjection - Behavior:
Execute Javascript - Content Source:
onClick Javascript - Body:
{!REQUIRESCRIPT('data:application/javascript;base64,BASE64_JS')}, except that you want to replaceBASE64_JSwith your Base64 encoded Javascript.
Create Home Page Component
VisitSetup > Home > Home Page Components
- Create a new Component
- Name:
UserInterfaceInjection - Type:
Links - Choose
UserInterfaceInjectionLink
Add to Home Page Layout
VisitSetup > Home > Home Page Layouts
- Edit your layout to include
UserInterfaceInjection
Page Layouts in Salesforce.
Conversation 10
REQUIRESCRIPT, and make sure that it is using single quotes.