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

selecting contact's address for a task #73

Closed rosieGK closed 10 years ago

rosieGK commented 10 years ago

Hi there

I want to select the contact's address information for a task. I am trying Select task.Id, task.Subject , Contact.MailingStreet from Task. But this is giving me an error Didn't understand relationship 'Contact' in field path. Any help???

Regards Rosie

thegogz commented 10 years ago

Hey Rosie,

This is more of a genral question then specific to Nforce.

You are trying to do a relationship query in SOQL, you need to traverse the relationship to your contact but there is no Contact relationship on Tasks, there is a relationship called the WhoId which contains the contact Id or Lead Id but its not traversable as its a polymorphic relationship as it supports more then one object.

The solution to your problem would be to do two separate queries and map the data together.

Below is some documentation that may help

SOQL Documentation

Task Object Documentation

Eoin

rosieGK commented 10 years ago

On 18/11/2014, at 8:45 PM, thegogz notifications@github.com wrote:

Thank you so much for your reply. This is really helpful.

Regards Rosie

Hey Rosie,

This is more of a genral question then specific to Nforce.

You are trying to do a relationship query in SOQL, you need to traverse the relationship to your contact but there is no Contact relationship on Tasks, there is a relationship called the WhoId which contains the contact Id or Lead Id but its not traversable as its a polymorphic relationship as it supports more then one object.

The solution to your problem would be to do two separate queries and map the data together.

Below is some documentation that may help

SOQL Documentation

Task Object Documentation

Eoin

— Reply to this email directly or view it on GitHub.

kevinohara80 commented 10 years ago

Thanks @thegogz for the help! Closing this.