My ultimate goal is to extract data from Salesforce accounts for general use in R. I noticed the RForcecom package ( https://hiratake55.wordpress.com/2013/03/28/rforcecom/ ), which looks very useful, thanks @ hiratake55 for it letter! Unfortunately, I have a little problem.
I can log in to my account and then access the objects inside and save as data.frame just like insert notes say.
The problem is that I want to access certain fields in a SOQL object, and I do not know the names of these fields.
Here is what I still have:
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 data.frame just like RForcecom says tin. Now I also want to extract, for example, the "Contact Owner Alias" field (the field has this name in the SalesForce web interface). 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 get all the file names 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 she thought that I would ask to find out if it was allowed inside R. If the answer is βgo learn SOQLβ, this is normal, I just thought I would ask first.
Thanks for any help!