4

There are some JavaScript functions used by the standard Salesforce pages that would be useful outside of the Standard pages. For example, the Account page has a "Copy Billing Address to Shipping Address" link that calls a copyAddr JS function. I'm building a custom VF page and would like to use that same functionality; however, I'd rather not build on top of something that is not relatively stable.

I can't find a Salesforce reference to standard Salesforce JavaScript functions. A standard JavaScript API seems like it would be useful.

  1. Does anyone use these JS functions? If so, which ones?

  2. Is there such a reference?

2 Answers 2

12

Unfortunately Salesforce doesn't offer any reference to the standard JS it use via the extJS library on it's pages.

Also the script has been obfuscated and is probably pretty hard to use.

I think your on your own as far as writing custom JS to accomplish this.

At least that's my experience, and at Bracket Labs we use javascript in our apps probably more than any other provider on the AppExchange.

3
  • 6
    I'd also add that using any javascript or relying on any HTML on the page that's not explicitly meant for customer use/development means that whatever you develop could be broken in any upcoming Salesforce release. Especially those releases where they do major UI overhauls. Aug 15, 2012 at 15:19
  • 2
    For just that reason, it is recommended to rely on either Static Resources or globally available CDN libraries.
    – joshbirk
    Aug 15, 2012 at 16:33
  • 1
    That said, I think its acceptable to copy methods out of their standard library and tweak them to your own use. I have done that on a number of occasions to good effect. You just have to copy all dependent code from their library so that you can re-name and replace their functionality with your own tweaked version.
    – ebt
    Aug 16, 2012 at 0:28
4

Jordan is correct, Salesforce js (and css for that matter) is not officially part of the API, it is subject to change at any time and should not be used by others. Trying to do what you're doing for an in-house thing is kludgy; if it's something you'll be selling it's a 'very bad idea'.

2
  • 2
    I agree, but it isn't unreasonable to think that something like copyBillingToShipping(), although trivial, could be available as part of a 'published' API. Aug 16, 2012 at 1:02
  • 1
    check out the ideaExchange and upvote the idea if it exists, otherwise you can add the idea itself. Probably your best bet
    – donjay
    Aug 27, 2012 at 17:20

You must log in to answer this question.

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