0

I am currently setting up email handling using Email2Case, when I click on "reply" in my email related list on Case I would want the field "TO" populated with the email address of the original sender of the email (the one that sent in and created the case, seen in the "SuppliedEmail" field on Case. If this is not possible I would at the very least have the "TO" field populated with the Account/Contact email address that is connected to the Case. I have read the help article, but it still does not work for me. Both the Account and the Contact have the same Email and are connected to the Case, still the "TO" field is empty. Is there something I am missing here?

I am first of all looking for a standard solution to this but also interested in custom solution for the email related list.

1 Answer 1

3

When I tried to fill the TO field with an email that was inside a Custom Object I had the same problem. In order to solve it I wrote the following code:

public with sharing class emailToAgenteEsterno{ public Case c; public Case c_1 {get;set;}

public EmailTemplate emailt1;    
public Account acc;
public CustomObject__c ae;

public emailToAgenteEsterno(ApexPages.StandardController controller){
    c = ( Case )controller.getRecord();

    c_1=[SELECT Id, Account.CustomObject__c, Account.CustomObject__r.Email__c, AccountId, CaseNumber  
         FROM Case 
         WHERE Id=:c.Id];

    // email Template        
    emailt1=[SELECT Id 
             FROM EmailTemplate 
             WHERE Name='XXX---EmailTemplate---XXX' ];        



}

    public pageReference returntopage(){            

        return new PageReference('/_ui/core/email/author/EmailAuthor?rtype=003&p24='+c_1.Account.Agente_Esterno__r.Email__c+'&p3_lkid='+c_1.Id+'&retURL='+c_1.Id+'&p5=&template_id='+emailt1.Id+''); 

    }

}

Inside the method returntopage() I used the parameter p24 to set the "Additional To" field. I think it might work for you too, if you don't solve it in other ways.

1
  • But this I assume uses some custom button or link, which initiates it? My scenario is the standard reply functionality. This solution holds for a custom implementation which I will have to use if I cannot get the stard to work. Do you have any knowledge about that?
    – erikduvet
    Jul 6, 2015 at 11:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.