0

My requirement is that I need to execute some javascript code in all standard SFDC pages so that I can capture some information and log it into a server. There are ways before to embed a HTML/VF page in side bar and messages & alerts components. But nothing seems to be working as I have tested all the approaches in latest salesforce dev environment.

I know there is already a post on this but I am asking again because the post is quite old and I would like to know if there is any feasibility to achieve in new SFDC version. If writing custom visual force page for every standard page, then it is a difficult thing to do and I would like to avoid it with a easiest solution.

Can any one please suggest a solution.

Old post: https://salesforce.stackexchange.com/questions/38918/end-of-javascript-sidebar-workarounds

Community
  • 1
  • 1
Ravi Dasari
  • 453
  • 1
  • 4
  • 10

1 Answers1

-2

For inserting code directly into any Salesforce page you need to use a Home Page Component (Setup > Customize > Home > Home Page Components).

Create a New Custom Component, Type = HTML Area. In the editor, check the "Show HTML" checkbox in the upper right. You can then put in arbitrary HTML and JavaScript and it can traverse the DOM.

If you just want your code on a single page, create a "Wide (Right) Column" component and add it to your page layout.

If you want the code to run on every* page in SFDC, then you'll want to put it into a "Narrow (Left) Column" (often referred to as the sidebar) component, check the Setup > Customize > User Interface > Show Custom Sidebar Components on All Pages checkbox, and finally select it in Setup > Customize > Home > Home Page Layouts > your layout.

Home Page Components don't need to have any visible UI.

Chatter pages don't have the sidebar, so this won't work there. The Service Cloud Console also doesn't show the sidebar and has no equivalent, so you can't do this there either.

Hleb
  • 7,037
  • 12
  • 58
  • 117
  • 1
    You have just commented an answer from the below link. That approach is nolonger working with latest salesforce. http://salesforce.stackexchange.com/questions/482/how-can-i-execute-javascript-on-a-sfdc-standard-detail-page – Ravi Dasari Jun 21 '16 at 15:53
  • I checked this link, and found that Caspar Harmer provided there workaroud. Did you already try it? – Hleb Jun 21 '16 at 18:38
  • yes. Tried all workarounds I could get my hands on :| – Ravi Dasari Jun 22 '16 at 00:23