Is there any way to find out all the Button in org who have used JavaScript in it.


Lets make it more simple -

How can I get List of all Button in sObject. (Where also I can differentiate between Content Source of Buttons - OnClick JavaScript / URL / Visualforce Page.

Any suggestions or help ?

  • 2
    Retrieve metadata as XML files using Deployment Tool or Eclipse plug in, search through the files. – Doug B Oct 9 '15 at 10:29
  • 1
    You need to do this from apex code or any external tool? – Bart Juriewicz Oct 9 '15 at 11:23
  • Agreed, Can you point me to some Document where I can found help with Apex Code or the Tool. – Salesforce Steps Oct 9 '15 at 12:08

The easiest way I can think of would be to install the Force.com IDE, create a new project that includes all SObjects in the org, and then use a tool like Windows Grep to search through the generated objects directory for certain strings depending on what you're interested in.

For example, an on-click JavaScript button might be represented like this in the object metadata files:

    <masterLabel>Test Execute JS</masterLabel>

So your best bet there would probably be to search for <openType>onClickJavaScript</openType> or <displayType>button</displayType>.

You'll need to play around with it and look through the object metadata files yourself to determine the best way to group your searches. For example, if you were interested in links as opposed to buttons, you would look for <displayType>link</displayType>.

Note that this method will not return results for buttons in Visualforce pages/components. You would need to search through the respective directories in your Force.com IDE project for those.


@JCD - Gave best answer --- But This also worked for me Thanks to "Tirth Patel"---

SELECT id , Name, pageorsobjecttype, DisplayType, LinkType FROM WebLink 
where DisplayType IN ('B','L') and LinkType ='javascript'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.