I have seen a similar question asked/answered in multiple places. The gist of the answer is to rely on SOQL Polymorphism. But most examples don't start with with the Account Object, which as far as I can tell has an AccountNumber as a native property on the standard objects. Why is it that a property on a standard object isn't available to the SOQL - am i miss reading the documentation? I did try the Polymoric query which yielded an error:
MALFORMED_QUERY: SOQL TYPEOF expressions are not supported in this organization
I suspect I can get around this by enabling the feature or waiting for a GA release. However that doesn't address the root cause of the problem, as someone new to SF (I am playing around with the JSForce wrapper API), I would like to know both why I am getting this exception on this object, and then some strategies to overcome the exception, and how those strategies work.
Here is my code - per the request (jsforce on NodeJs with ES6 Harmony).
const co = require('co')
, _ = require('lodash')
, jsforce = require('jsforce')
, jsforceConn = new jsforce.Connection()
const accountQuery = '\
SELECT \
AccountNumber \
, name \
, ownerId \
, Client__c \
, Owner.Name \
, Owner.Email \
FROM Account ' ;
const accounts = function*(userName, pwd) {
let connection = yield jsforceConn.login(userName, pwd)
let results = yield jsforceConn.query(accountQuery)
let firstTenResults = _.first(results.records, 5)
console.log(JSON.stringify(firstTenResults, null, 4));
connection.logout()
}
AccountNumber
field, but you don't have that field listed in your code. Is this accurate?