0

What is the current way to do a custom button with some js in it?

We are building a custom button that needs to be able to read from the current contact (email address, phone, mailing address), and run a few lines of js. (We also need to create a call record.)

But how/where is this done in salesforce these days?

This page doesn't point me anywhere: https://help.salesforce.com/apex/HTViewHelpDoc?id=customize_enterprise.htm

And this explanation of the new method in Lightning isn't clear where the js lives: https://developer.salesforce.com/forums/?id=906F0000000BWr4IAG

Where is the needed example/doc?

1 Answer 1

2

If you are using buttons on custom visualforce page there are no any problems with defining custom JS function for it. For example, if you use <apex:commandButton/> you can use such attributes as onclick, onkeydown, onkeyup and other. See more information in documentation.

If you are using buttons on object layouts, you can create custom button and chose executing of JS as a behavior, see attached screenshot.enter image description here

If you mean some other cases, please, describe it.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.