My final aim is to extract data from Salesforce accounts for general use in R. I spotted the RForcecom package (https://hiratake55.wordpress.com/2013/03/28/rforcecom/) which looks very useful indeed, thanks @hiratake55 for writing it! Unfortunately, I am having a small problem.
I am able to sign in to my account and then access objects within and store as a data.frame just as the intro notes say.
The problem is that I want to access certain fields within the SOQL object and I don't know the names of those fields.
Here is what I have so far:
library(RForcecom)
username <- "" # my email address
password <- "" # my website password + security token
instanceURL <- "https://eu5.salesforce.com/"
apiVersion <- "34.0"
session <- rforcecom.login(username, password, instanceURL, apiVersion)
# R Query
objectName <- "Contact"
fields <- c("Id", "Name", "Phone")
rforcecom.retrieve(session, objectName, fields)
This works fine and returns a data.frame just as RForcecom says on the tin. Now I also want to extract for example the field "Contact Owner Alias" (the field has this name on the web interface of SalesForce). I tried the following:
fields <- c("Id", "Name", "Phone", "Contact Owner Alias")
rforcecom.retrieve(session, objectName, fields)
This gave an error:
Error in rforcecom.query(session, soqlQuery) :
MALFORMED_QUERY: Id, Name, Phone, Contact Owner Alias FROM Contact
^
ERROR at Row:1:Column:38
unexpected token: Alias
QUESTION
Is there a way to retrieve all of the filenames in R? Or is there a way to return data from all fields without knowing their names.
CAVEAT
I know that part of the problem is my unfamiliarity with SOQL but it thought I would ask around to see if this had been solved inside R. If the answer is "go learn SOQL" that's ok, I just thought I would ask first.
Thanks for any help!