I planning to use custom button. I can write all the functionality related to button using Javascript API, so that i do not need to write any apex code.

Another way is i can write an apex class and invoke those apex methods in the custom button.

Which one will be the best way?

Any suggestions? Thanks for helping me to clarify.

1 Answer 1


If a functionality can be achieved native using just apex code and visualforce mark up i would prefer that against java-scripting.

Also if you are planning to use ajax toolkit with custom button then rather i would prefer visualforce as visualforce is easier to implement and maintain for any force.com developer.

Apex has a testing framework and thus you can test the logic of your code as opposed to javascript

  • Assuming Javascript is disabled, a lot of visualforce functionality and native salesforce functionality is disabled. As far as I know even the default login page requires javascript to be enabled. Oct 25, 2013 at 7:35
  • I see but you will have to agree with second point .Ajax toolkit is complex for beginners and hard to learn while visualforce most developers are thaught when they start coding on platform Oct 25, 2013 at 7:39
  • I do agree that it may be easier to maintain and more reliable to use VF/Apex. Oct 25, 2013 at 7:41
  • ok i have removed the debatable point of enabling and disabling javascript .How was the last point?Testing framework of apex .Is it not bonus ? Oct 25, 2013 at 7:44
  • Although this is definitely opinion bases, I agree that VF/Apex is easier to pickup for a beginner than the ajax toolikit, as well as the testing framework being a nice bonus Oct 25, 2013 at 11:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .