Apex语法帮助:默认电子邮件字段

时间:2018-08-29 19:31:18

标签: salesforce salesforce-lightning

团队,我正在尝试为我们的Salesforce LEX案例页面创建快速操作。我们的总体目标是拥有默认的支持电子邮件,以便用户不必在每次发送电子邮件时都从“发件人”选择列表中进行选择。任何帮助表示赞赏。

global class CaseEmailDefault implements QuickAction.QuickActionDefaultsHandler {
// Empty constructor
global CaseEmailDefault () {
}

// Main interface method
global void onInitDefaults(QuickAction.QuickActionDefaults[] defaults) {
    QuickAction.SendEmailQuickActionDefaults sendEmailDefaults = (QuickAction.SendEmailQuickActionDefaults)defaults.get(0);
    EmailMessage emailMessage = (EmailMessage)sendEmailDefaults.getTargetSObject(); 
    OrgWideEmailAddress[] owea = [select Id from OrgWideEmailAddress where Address = 'support@gmail.com'];

    Case c = [SELECT CaseNumber, Priority, Status FROM Case WHERE Id=:sendEmailDefaults.getContextId()];


    if (c.Status == 'Draft') {
        emailMessage.FromAddress = 'support@gmail.com'; //this is not working
        emailMessage.Subject = 'First Email'; //this is working 
    }        
} 

}

0 个答案:

没有答案