function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Arun ChaubeyArun Chaubey 

Error: Compile Error: Invalid type: Warehouse__c at line 7 column 39

Hi friends, I am getting this error " Error: Compile Error: Invalid type: Warehouse__c at line 7 column 39 " while practising the visualforce workbook exercise - Creating the WarehouseUtils Class .
global with sharing class WarehouseUtils {
public WarehouseUtils(ApexPages.StandardSetController controller) { }
// Find warehouses nearest a geolocation
@RemoteAction
global static List<Warehouse__c> findNearbyWarehouses(String lat, String lon) {
// Initialize results to an empty list
List<Warehouse__c> results = new List<Warehouse__c>();
// SOQL query to get the nearest warehouses
String queryString =
'SELECT Id, Name, Location__Longitude__s, Location__Latitude__s, ' +
'Street_Address__c, Phone__c, City__c ' +
'FROM Warehouse__c ' +
'WHERE DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') < 20 ' +
'ORDER BY DISTANCE(Location__c, GEOLOCATION('+lat+','+lon+'), \'mi\') ' +
'LIMIT 10';
// Run the query
results = database.Query(queryString);
// Return the query results
return(results);
}
}
Anybode help ?
Best Answer chosen by Arun Chaubey
Arun ChaubeyArun Chaubey
Hi Yuchen,

Thanks for your quick reply. Actuualy I have a Warehouse object with Warehouse__c API name, but i deleted that object before, Now my code executes successfully. 

All Answers

YuchenYuchen
Could you make sure you have an Object with API name as "Warehouse__c"? Also, do you have access to that Object?
Arun ChaubeyArun Chaubey
Hi Yuchen,

Thanks for your quick reply. Actuualy I have a Warehouse object with Warehouse__c API name, but i deleted that object before, Now my code executes successfully. 
This was selected as the best answer
mukesh nanimukesh nani
same wxample but i gt an err like this
unexpected token: @ at line 4 column 0