+ Start a Discussion
S2S CRM AdminS2S CRM Admin 

View volunteer jobs by campaign

I am using the NPSP and I am trying to write a select statement that will gather all of the events that are part of a single campaign.
I have come up with the following statement:
SELECT Name from GW_Volunteers__Volunteer_Job__c WHERE Campaign='701i00000010q96'

When I run this statement I recieve the following error:
PHP Fatal error:  Uncaught SoapFault exception: [sf:INVALID_FIELD] INVALID_FIELD: 
GW_Volunteers__Volunteer_Job__c WHERE Campaign='701i00000010q96'
                                      ^
ERROR at Row:1:Column:56
No such column 'Campaign' on entity 'GW_Volunteers__Volunteer_Job__c'. If you are attempting to use a custom field, be sure to append the '__c' after the custom field name. Please reference your WSDL or the describe call for the appropriate names. in C:\Sites\s2s\htdocs\salesForce\soapclient\SforceBaseClient.php:808
Stack trace:
#0 C:\Sites\s2s\htdocs\salesForce\soapclient\SforceBaseClient.php(808): SoapClient->__call('query', Array)
#1 C:\Sites\s2s\htdocs\salesForce\soapclient\SforceBaseClient.php(808): SforceSoapClient->query(Array)
#2 C:\Sites\s2s\htdocs\test.php(27): SforceBaseClient->query('SELECT Name fro...')
#3 {main}
  thrown in C:\Sites\s2s\htdocs\salesForce\soapclient\SforceBaseClient.php on line 808

When I look on the schema, it shows Campaign as part of the object, and from the research that I have done I know that I am allowed to view the campaign information. What exactly am I doing incorrectly?
Best Answer chosen by S2S CRM Admin
Manish BhatiManish Bhati
To be clear the API name for the field Campaign you are using is wrong or the major problem could be that GW_Volunteers__Volunteer_Job__c object does not have any field Campaign. So, you may have to do union with other object having Campaign field.

Try this query in Developer console first.

If you have Salesforce admin access go to the GW_Volunteers__Volunteer_Job__c object and click on the Campaign field to see the API name for it.
 

All Answers

Manish BhatiManish Bhati
Are you sure the API name for the field Campaign is Campaign only?

Because the API name should be like Campaign__c or CampaignId (If it is a standard field).
S2S CRM AdminS2S CRM Admin
From what I can understand of the schema yes, Campaign is a lookup field for GW_Volunteers__Volunteer_Job__c. Just to be safe I tried both of your suggestion and get the same error, except campaign changes to either Campaign__c or CampaignId in the error message.
Manish BhatiManish Bhati
To be clear the API name for the field Campaign you are using is wrong or the major problem could be that GW_Volunteers__Volunteer_Job__c object does not have any field Campaign. So, you may have to do union with other object having Campaign field.

Try this query in Developer console first.

If you have Salesforce admin access go to the GW_Volunteers__Volunteer_Job__c object and click on the Campaign field to see the API name for it.
 
This was selected as the best answer