You need to sign in to do that
Don't have an account?
mail2ghani1.3921762673905103E12
Compile Error: Return type of global method must also be global: Account
Hai all
i get the error Compile Error: Return type of global method must also be global: Account at line 5 column 23
Resource(urlMapping='/Account/*')
global with sharing class MyRestResource
{
@HttpGet
global static Account doGet ()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
return result;
}
}
i get the error Compile Error: Return type of global method must also be global: Account at line 5 column 23
Resource(urlMapping='/Account/*')
global with sharing class MyRestResource
{
@HttpGet
global static Account doGet ()
{
RestRequest req = RestContext.request;
RestResponse res = RestContext.response;
String accountId = req.requestURI.substring(req.requestURI.lastIndexOf('/')+1);
Account result = [SELECT Id, Name, Phone, Website FROM Account WHERE Id = :accountId];
return result;
}
}
Do you by any chance have a custom object in your org named Account ?
while investigating for your case I came acros these posts which talks about a similar issue:
http://salesforce.stackexchange.com/questions/24278/error-while-trying-webservice
https://developer.salesforce.com/forums?id=906F0000000915PIAQ
pls go thru and update if this helps!