• Shane Korosec
  • NEWBIE
  • 5 Points
  • Member since 2017

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies

I have a simple joined soql query i'm using
SELECT Id, FirstName, LastName, Email, (SELECT AccountId, CreatedDate, ActivityDate, Subject, Description, ActivityType, CallType from ActivityHistories) FROM Contact WHERE Id = '".$id."'"

which works great for me. Now I want to get info from a custom object called 'Position__c', so i've added it to the selects
SELECT Id, FirstName, LastName, Email, (SELECT AccountId, CreatedDate, ActivityDate, Subject, Description, ActivityType, CallType from ActivityHistories), (SELECT Id, Position_title__c, End_Date__c FROM Position__c) FROM Contact WHERE Id = '".$id."'"

But I get an error with that, quoting 'Didn't understand relationship 'Position__c' in FROM part of query call.' I have also tried it with 'Position__r' also but get the same error.

Can anyone help me to run a successful query?

I have a simple joined soql query i'm using
SELECT Id, FirstName, LastName, Email, (SELECT AccountId, CreatedDate, ActivityDate, Subject, Description, ActivityType, CallType from ActivityHistories) FROM Contact WHERE Id = '".$id."'"

which works great for me. Now I want to get info from a custom object called 'Position__c', so i've added it to the selects
SELECT Id, FirstName, LastName, Email, (SELECT AccountId, CreatedDate, ActivityDate, Subject, Description, ActivityType, CallType from ActivityHistories), (SELECT Id, Position_title__c, End_Date__c FROM Position__c) FROM Contact WHERE Id = '".$id."'"

But I get an error with that, quoting 'Didn't understand relationship 'Position__c' in FROM part of query call.' I have also tried it with 'Position__r' also but get the same error.

Can anyone help me to run a successful query?