You need to sign in to do that
Don't have an account?
Terry411
Deployment Error No Such Column Exists
I'm getting the following error:
System.QueryException: No such column 'Location__c' on entity 'Special_Event__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.
Stack Trace: Class.ORC.<init>: line 81, column 1 Class.ORTests.testORC: line 196, column 1
System.QueryException: No such column 'Location__c' on entity 'Special_Event__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.
Stack Trace: Class.ORC.<init>: line 81, column 1 Class.ORTests.testORC: line 196, column 1
- Special_Event__c.Location__c does exist and its a GeoLocation field type
- It is visable to all profiles.
- Special_Event__c is Deployed.
- I've updated the class to API 38 thinking perhaps it's prior API version didn't support GeoLocation but that didn't help
- I tried rewriting the soql statement to a string with a database.execute() statement but again no luck.
All Answers
Add Location__c fields to your outbound changeset and start your deployment.
Let us know if it helps,
Thanks,
Balayesu
Could you please paste the query which you are using , over here?
Thanks
map<Id, Special_Event__c> seMap = new map<Id, Special_Event__c>([select id, Name, Event_Date__c, Site_Address_Line__c,
Site_Contact__r.Physical_Zip_Postal_Code__c, Total_Appointments__c,
Scheduled_Appointments__c, Scheduling_Notes__c
from Special_Event__c
where Type__c = :searchType
and Event_Date__c > :searchDateTime
and DISTANCE(Location__c, GEOLOCATION(:latitude, :longitude), 'mi') < :decimal.valueOf(radius)
order by DISTANCE(Location__c, GEOLOCATION(:latitude, :longitude), 'mi')
limit 10]);
Hi Terry,
Please visit this link, and check : -
https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_geolocate.htm
Thanks
string q = 'select id, Name, Event_Date__c, Site_Address_Line__c,';
q += ' Site_Contact__r.Physical_Zip_Postal_Code__c, Total_Appointments__c, Scheduled_Appointments__c, Scheduling_Notes__c';
q += ' from Special_Event__c';
q += ' where Type__c = \'' + searchType + '\'';
q += ' and Event_Date__c > ' + searchDateTime;
q += ' and DISTANCE(Location__c, GEOLOCATION(' + String.valueOf(latitude) + ',' + String.valueOf(longitude) + '), \'mi\') < ' + radius;
q += ' order by DISTANCE(Location__c, GEOLOCATION(' + String.valueOf(latitude) + ',' + String.valueOf(longitude) + '), \'mi\')';
q += ' limit 10';
system.debug('******************* q: ' + q);
list<Special_Event__c> seList = Database.query(q);
- I recreated the Location__c field in production. Deployment FAILED: System.QueryException: No such column 'Location__c'
- I modified the query string to remove the DISTANCE( ) lines from the WHERE & ORDER BY clause. Deployment VALIDATES
- I modified the query string to include Location__Latitude__s and Location__Longitude__s fields with DISTANCE ( ) lines still removed. Deployment VALIDATES
- I added the DISTANCE( ) lines back into the ORDER clause left it out of the WHERE clause. Deployment FAILED
- I added the DISTANCE( ) lines back into the WHERE clause and left out the ORDER clause. Deployment FAILED
Here's the query in code:
Here's how the query looks via the debug log:
[30]|DEBUG|******************* q: select id, Name, Event_Date__c, Site_Address_Line__c, Site_Contact__r.Physical_Zip_Postal_Code__c, Total_Appointments__c, Scheduled_Appointments__c, Scheduling_Notes__c from Special_Event__c where Type__c = 'Public' and Event_Date__c > 2017-02-12T13:51:00z and DISTANCE(Location__c, GEOLOCATION(41.564346,-93.6236969), 'mi') < 50 order by DISTANCE(Location__c, GEOLOCATION(41.564346,-93.6236969), 'mi') limit 10
If I copy this query into the run anonymous window in production, it works perfectly fine. All the code is version 38 with is compatible in both production and sandbox.