You need to sign in to do that
Don't have an account?

Error about refering a Contact from Account returned in method
Hi,
I have a problem using the returned value marked in yellow. Can anyone tell me what's wrong? I'm a bit stucked! Thank you,
System.assertEquals(contactoEsperado.get(0).FirstName,Cuenta.Contacts.FirstName);
System.assertEquals(contactoEsperado.get(0).LastName,Cuenta.Contacts.LastName);
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
@HttpGet
global static Account getAccount() {
RestRequest request = RestContext.request;
// grab the caseId from the end of the URL
String AccountId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account result = [SELECT ID,Name,(SELECT ID,Name
FROM Contacts)
FROM Account
WHERE ID=:AccountId
LIMIT 1];
return result;
}
}
I have a problem using the returned value marked in yellow. Can anyone tell me what's wrong? I'm a bit stucked! Thank you,
System.assertEquals(contactoEsperado.get(0).FirstName,Cuenta.Contacts.FirstName);
System.assertEquals(contactoEsperado.get(0).LastName,Cuenta.Contacts.LastName);
@RestResource(urlMapping='/Accounts/*/contacts')
global with sharing class AccountManager {
@HttpGet
global static Account getAccount() {
RestRequest request = RestContext.request;
// grab the caseId from the end of the URL
String AccountId = request.requestURI.substring(
request.requestURI.lastIndexOf('/')+1);
Account result = [SELECT ID,Name,(SELECT ID,Name
FROM Contacts)
FROM Account
WHERE ID=:AccountId
LIMIT 1];
return result;
}
}