You need to sign in to do that
Don't have an account?
AmbigaRam
Mapping fields within in same object
Hi,
I need to copy the project name when the new case is created by email
For that I created new custom settings "CaseProject" with custom fields CaseEmail (field Email) It contains the values of ToAddress of the email message.
Following are my trigger code, When I saved ,I get the complation Error:unexpected token: 'Map' at line 15 column 8
Please help me to solve this issue.
trigger UpdateMostRecentmessageOnCase on EmailMessage (after insert) { Case relatedCase; Contact relatedCaseContact; for (EmailMessage e_msg : trigger.new) { //Find the related case. relatedCase = [SELECT Id FROM Case WHERE Id = :e_msg.ParentId]; Integer msgCount = [SELECT COUNT() FROM EmailMessage]; If (relatedCase != null) { //If the case was found, updated the most recent comment. If(e_msg.ToAddress != null) { Map prjts = CaseProject__c.getAll(); List mails = new List(); mails.addAll(prjts.keySet()); for (String key : mails) { CaseProject__c cToP = prjts.get(key); if(cToP.ProjectEmail__c.equals(e_msg.ToAddress)) { relatedCase.Project_Name__c = cTop.Name; } } relatedCase.Most_Recent_Email_Message__c = e_msg.textBody; relatedCase.CaseEmail__c = e_msg.ToAddress; update relatedCase; } } } }
Thanks and Regards.,
Ambiga
Map<String, CustomSetting__c>
So, in your case, it would look like:
Map<String, CaseProject__c> prjts = CaseProject__c.getAll();
Hi ,
I tried that one. But again expecting the error in lists.
Will you please tell me is it possible mapping of two field within the same object.
If it is, please write the sample code.
Thanks & Regards.
Ambiga
Hi ,
Thanks for your reply and finally I resolved my problem
Regards,
Ambiga