Salesforce to Socrata

This walkthrough goes through the steps of taking data from Salesforce and then loads that into an existing Socrata table using write. Rforcecom Example from Takekatsu Hiramura

Step 1: Install Required Dependencies


Step 2: Log into Salesforce

To sign in to the, use rforcecom.login() function

username <- ""
password <- "YourPasswordSECURITY_TOKEN"
instanceURL <- ""
apiVersion <- "26.0"
(session <- rforcecom.login(username, password, instanceURL, apiVersion))

Step 3: Query Salesforce

Make a query using Salesforce Query language (SOQL), not to be confused with the Socrata Query Language (SoQL)..

soqlQuery <- "SELECT Id, Name, Phone FROM Account WHERE AnnualRevenue > 50000 LIMIT 5"
rforcecom.query(session, soqlQuery)

Step 4: Identify Destination Dataset

Ensure that you have a Socrata dataset with proper fields and proper datatypes to write to. Capture the 4x4 ID for the dataset you want to publish to.

Step 5: Write to Your Dataset

socrataEmail <- Sys.getenv("SOCRATA_EMAIL", "")
socrataPassword <- Sys.getenv("SOCRATA_PASSWORD", "XXXXXXX")
datasetToAddToUrl <- "" 
write.socrata(table, datasetToAddToUrl, "UPSERT", socrataEmail, socrataPassword)

For full documentation on Rforcecom please see