We have a custom object program__c. We have a lookup field on the Tasks object to program under 'Related To'.
Below is my current query. Program__c is pulling the program code, but I want the program Name. I've tried program__c.name and program__r.name but it does not work (see errors below). The 'field name' of the Program Name on the Program__c object is 'name'.
Current Code:
SELECT Salesforce_18_Digit_ID__c, firstName, lastName, email, phone, mobilePhone,
(SELECT program__r.name, Id, CreatedDate FROM Tasks) FROM Contact c
Error for program__c.name
[InvalidFieldFault [ApiQueryFault [ApiFault exceptionCode='INVALID_FIELD' exceptionMessage=' (SELECT program__c.name, ^ ERROR at Row:11:Column:9 Didn't understand relationship 'program__c' in field path. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names.' extendedErrorDetails='{[0]}' ] row='11' column='9' ] ]
Error when using program__r.name
[InvalidSObjectFault [ApiQueryFault [ApiFault exceptionCode='INVALID_TYPE' exceptionMessage='sObject type 'Tasks' is not supported. If you are attempting to use a custom object, be sure to append the '__c' after the entity name. Please reference your WSDL or the describe call for the appropriate names.' extendedErrorDetails='{[0]}' ] row='-1' column='-1' ] ]
WhatId
?