kevinohara80 / nforce

nforce is a node.js salesforce REST API wrapper for force.com, database.com, and salesforce.com
MIT License
474 stars 167 forks source link

create Records for Salesforce relationship objects? #106

Closed pentode closed 5 years ago

pentode commented 8 years ago

Hi,

I've found myself working around the behaviour of nforce not converting returned relationship objects into nforce Records, e.g., for the following query:

SELECT Contact.Id, Contact.Account.Id, Contact.Account.Name FROM Contact ...

I would prefer that nforce returned the Account as a Record instead of a plain object and the following would work for the contact Record returned by that query.

var acct = contact.get('account');
acct.get('name');

At the moment, I find myself writing nforce.createSObject(...) quite a bit, and it "feels" right for nforce to provide this functionality.

The change is quite simple (https://github.com/pentode/nforce/commit/f886936ba11b4d56dc451408adde277608f8620e) and doesn't break any existing tests, but I do understand this would likely be a breaking change for other users of nforce, so I don't expect you'll include it in any 1.x series.

Is this something you'd consider adding for version 2.x?

cheers! Brent

kevinohara80 commented 8 years ago

Yeah this is something to consider. I'll take a look at this after the holidays are over. Thanks!

kevinohara80 commented 8 years ago

@pentode Your commit looks fine. Want to send it in a PR? I'm fine with jumping to 2.0.

JAertgeerts commented 8 years ago

@pentode @kevinohara80 Created PR as this would be useful..

kevinohara80 commented 5 years ago

Merged into the 2.0 branch