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

I am getting this error
Error: Compile Error: Didn't understand relationship 'eMessage__r' in FROM part of query call. If you are attempting to use a custom relationship, be sure to append the '__r' after the custom relationship name. Please reference your WSDL or the describe call for the appropriate names. at line 230 column 25
my code:
Public static void mostRecentRead (List<eMessage__c> emsgList){
List<Case> caslst = [Select CaseNumber,Most_Recent_Read__c,(select Name,Is_Read__c from eMessage__r) FROM Case where Most_Recent_Read__c = false];
if(caslst != null){
for(eMessage__c m : emsgList){
cas = [select id,casenumber,Most_Recent_Read__c from case where id =: m.Case_Number__c limit 1];
if(cas != null)
cas.Most_Recent_Read__c = true;
}
update(cas);
}
}
}
Actually this code is written for to update most recent read check box in case whenever Read field in eMessage(custom Object) is checked manually . If the eMessage object has the attachment and that attachment is read and manually checked Read checkbox in eMeassage object then the most recent read check box in case should update(as checked) automatically.
Please anyone help me out its urgent!!!!!
my code:
Public static void mostRecentRead (List<eMessage__c> emsgList){
List<Case> caslst = [Select CaseNumber,Most_Recent_Read__c,(select Name,Is_Read__c from eMessage__r) FROM Case where Most_Recent_Read__c = false];
if(caslst != null){
for(eMessage__c m : emsgList){
cas = [select id,casenumber,Most_Recent_Read__c from case where id =: m.Case_Number__c limit 1];
if(cas != null)
cas.Most_Recent_Read__c = true;
}
update(cas);
}
}
}
Actually this code is written for to update most recent read check box in case whenever Read field in eMessage(custom Object) is checked manually . If the eMessage object has the attachment and that attachment is read and manually checked Read checkbox in eMeassage object then the most recent read check box in case should update(as checked) automatically.
Please anyone help me out its urgent!!!!!
chack out this resiurce http://www.salesforce.com/us/developer/docs/dbcom_soql_sosl/Content/sforce_api_calls_soql_relationships.htm
I think your error is die to the fact that __r is for going 'up', while you're trying to go 'down' the relationship..
-Art.
also your code is not optimized. you have SOQL inside for loop (select id,casenumber,Most_Recent_Read__c from case ).
1) Get the set of casenumber
2) use SOQL with in to get all the cases into map.
3) Get the case using map