Find your content:

Search form

You are here

What the best way to store data from Javascript in "salesforce"


I'm writing a small analytics app in Javascript and want to store data in a database. Since I am new to salesforce I can't figure out the best way to do this:

  • a normal DB such as heroku (postgresql)
  • (couldn't find much on how to access via JS)
  • ?
  • APEX ?

Thanks for pointers.

Update: For now all the javscript is inside the code of the Home Page component.

Attribution to: Cilvic

Possible Suggestion/Solution #1

Normally you would want to do this by sending data via a REST call to your salesforce, you can create your own REST API functions in apexrest more about that here: In these apexrest functions you would handle the incoming data, store it in the database, do calculations, ...

The problem you have there is, you can't do cross domain rest calls, a solution here is either do the call from your webserver backend (via PHP or something else) or you include your javascript file directly from your domain where the rest call is being send to.

Attribution to: pjcarly
This content is remixed from stackoverflow or stackexchange. Please visit

My Block Status

My Block Content