Is there a way to access the following string "/soap/ajax/33.0/connection.js" in {!requireScript("/soap/ajax/33.0/connection.js")} by using custom labels in custom buttons? So that whenever there is a change in ajax version, it can be updated in custom labels & it will eventually update in all custom buttons. Please advise.

1 Answer 1


{!} denotes an evaluated formula. You could try:

{!requireScript("/soap/ajax/" & $Label.myLabel & "/connection.js")}

But why would you want to do this? Doing a mass update to every instance of this is potentially removing the very predictability that API version is designed to give you.

There was another question about autoupdating Apex classes where I discussed some of the things that can change from one API version to another. Check out that answer here.

Please read it so you understand the ramifications of a mass update of every API version...even if my suggestion works.

  • Although, in all fairness, there's less risk of upgrading the toolkit than upgrading a class/page/component version blindly, but I still wouldn't intentionally do that.
    – sfdcfox
    Mar 20, 2015 at 5:43
  • I agree...lower risk. Which is why I bothered to suggest a way to do it. But I could see this question being the thin end of the wedge..."well, we do it with our JS custom buttons...why aren't we doing it with Apex/VF, too!?"
    – pchittum
    Mar 20, 2015 at 17:03
  • Salesforce can, and has, removed some fields between lower API versions and higher ones. If one uses this technique, they still risk stuff breaking.
    – sfdcfox
    Mar 20, 2015 at 19:04
  • Thanks so much @Peter. Your solution works pretty good!. The reason to use this (only for custom buttons of type: onclick Javascript) we got an error when the detail page of record loads, the DOM refers the ajax toolkit version of the last button in the object and applies to ajax toolkit methods used in other button in object. In our scenario, the last button in the object has very older version 13.0 which displayed some errors. May 19, 2015 at 11:13
  • @Peter, But I'd one concern, can you please advise me on the below? Let's say there are ajax toolkit methods which are deprecated as part of some old version (for eg: version 18.0). If I update the version of that button from 18.0 to latest version. Will that method be still supported? P.S: If it is not supported, my plan is to not update the version for those buttons. Sorry for the late comment to your answer. Thanks May 19, 2015 at 11:25

You must log in to answer this question.

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