You need to sign in to do that
Don't have an account?
Tamil
Send Email Quick Action : QuickActionDefaultsHandler
In the Case object, I have Contact lookup. Until the case is not closed the contact lookup will keep changing as per business requirements. My issue is when the user tries to send an email the Sendmail Email action is not picking the current contact instead it is picking Old send email contact . I contacted SF Support and SF support suggested to use: QuickAction.QuickActionDefaultsHandler
Here is the code I am using for SendEmail quick action.
Now issue is
sample screen shot:
Here is the code I am using for SendEmail quick action.
global class SendEmailQuickAction implements QuickAction.QuickActionDefaultsHandler { global SendEmailQuickAction() { } global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) { Id ContId; QuickAction.SendEmailQuickActionDefaults sendEmailDefaults = (QuickAction.SendEmailQuickActionDefaults)defaults.get(0); if(sendEmailDefaults.getActionName() == 'Case.SendEmail1' && sendEmailDefaults.getActionType() == 'SendEmail') { ContId = sendEmailDefaults.getContextId(); EmailMessage varemailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject(); Case varCase = [SELECT Contact.Email,Contact.Name,Contact.Id,ContactId from Case Where Id = :ContId Limit 1]; varemailMessage.ToAddress = ''; varemailMessage.ToAddress = varCase.ContactId; } } }
Now issue is
- I am not able to populate Contact. When I use ContactID I am seeing the ID not the contact Name.
- I am seeing all old send email contact in ToAddress when I try to send an email.
sample screen shot: