I'm using Andrew Fawcett's legendary Apex Wrapper Salesforce Metadata API in several projects. It perfectly works and provides a new dimension of APEX programming. Now there are situations where it would be more convenient to access Metadata API via JavaScript instead of APEX.

This is the case for projects, where the heavy lifting part of the logic is already JavaScript and an additional round-trip to APEX is making things more complicated. Especially with asynchronous functions and repetitive queries for completion the ping-pong between JS and APEX is hard-to-read and hard-to-maintain.

The only official JS wrapper I'm aware of is http://www.salesforce.com/us/developer/docs/ajax/

However it's possible to create a SOAP string and use XMLHttpRequest or $.ajax() to make the callout. Works fine.

To create the SOAP string I'm following the suggestions here and use SoapUI - which is free and really a smart tool.

My first question: is there a tool similar to Wsdl2Apex which converts entire WSDL to Javascript and works with the challenges of metadata.wsdl? (polymorphic, etc.)

Looking ahead, I would end up in rewriting many functions (or all). I'm now just wondering if I'm the first one who needs it or if there is already something existent? If there is nothing, I would also like to collaborate in a new project - just in case if others would be interested in such a JS wrapper, too.

The same need finally also applies to Tooling API.

1 Answer 1


JSForce includes javascript access to the Metadata API. https://jsforce.github.io

  • This looks very cool and I'll give it a try! Thanks Jim!
    – Uwe Heim
    Mar 3, 2015 at 18:55
  • It also covers Tooling API and other APIs.
    – Uwe Heim
    Mar 4, 2015 at 0:45
  • Yes, it does. I have also implemented a Visualforce / Bulk API interface with it as well. The Developers are very responsive to questions and issues as well.
    – JimRae
    Mar 4, 2015 at 13:54
  • Quick test - great result! If we could use it for Lightning it too, it would be perfect - but before that Salesforce needs to open up the API salesforce.stackexchange.com/questions/68124/…
    – Uwe Heim
    Mar 4, 2015 at 14:13
  • I would post that as an enhancement on the jsforce project.
    – JimRae
    Mar 4, 2015 at 16:24

You must log in to answer this question.

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