Loading
Slack製品の問い合わせ先はSalesforce Helpへ統合・変更されます続きを読む
PHPの脆弱性に関する監視状況について 続きを読む
Salesforce Scheduler での予定の管理
Apex アクションの Apex クラスの作成

Apex アクションの Apex クラスの作成

Apex アクションにリンクできる Apex クラスを作成します。Apex クラスのメールテンプレート名は、認証されていないユーザーにビデオ予定のメール通知を送信するために使用されるメールテンプレートを参照します。設定に基づいてテンプレートの名前を変更できます。

必要なエディション

使用可能なインターフェース: Lightning Experience。
使用可能なエディション: Enterprise Edition および Unlimited Edition
  1. [設定] アイコンをクリックし、[開発者コンソール] を選択します。
  2. ファイル | 新規 | Apex クラス をクリックします。
  3. Apex クラスの名前を入力します (例: SendEmailToGuest)。
  4. Apex クラスコードを追加します。

    Apex クラスの Apex コードのサンプルを次に示します。このコードを使用して、サードパーティビデオアプリケーションで予定種別を使用して予定がスケジュールされている場合に、予定の確認メールを送信します。

    public class SendEmailToGuest {
    
       @InvocableMethod(label='Send Email To Guest' callout='true')
    
       public static Void SendEmailToGuestUsingEmailTemplate(List<inputvariables> inputParams)
    
       {
    // Replace this unique name based on the email template used 
           EmailTemplate et = [SELECT Id,Subject, Body FROM EmailTemplate WHERE DeveloperName ='SchedulerUnauthenticatedUserAppointmentTypeEmailTemplateForThirdParty'];
           List<string> toAddress = new List<string>();
           toAddress.add(inputParams.get(0).leadEmail);
           Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
    
           mail.setTemplateId(et.Id);
           mail.setToAddresses(toAddress);
           mail.setTargetObjectId(inputParams.get(0).leadId);
           mail.setWhatId(inputParams.get(0).appointmentId);
           mail.setSaveAsActivity(false);
           mail.setUseSignature(false);
           List<Messaging.SingleEmailMessage> allmsg = new List<Messaging.SingleEmailMessage>();
           allmsg.add(mail);
           try {
               Messaging.sendEmail(allmsg,false);
               return;
           } catch (Exception e) {
               System.debug(e.getMessage());
           }
       }
        
        public class inputvariables {
            @InvocableVariable
            public String leadEmail;
            @InvocableVariable
            public String leadId;
            @InvocableVariable
            public String appointmentId;
            
        } 
    }
    

    設定に基づいて仮想の予定のメールテンプレートの一意の名前を置き換えることができます。使用可能な一意のテンプレート名は次のとおりです。

    SchedulerUnauthenticatedUserAppointmentTypeEmailTemplateForAmazonChime
    Amazon Chime で予定種別を使用して予定がスケジュールされている場合の予定の確認用のメールテンプレート。
    SchedulerUnauthenticatedUserEngagementChannelEmailTemplateForAmazonChime
    Amazon Chime でエンゲージメントチャネルを使用して予定がスケジュールされている場合の予定の確認用のメールテンプレート。
    SchedulerUnauthenticatedUserAppointmentTypeEmailTemplateForThirdParty
    サードパーティビデオアプリケーションで予定種別を使用して予定がスケジュールされている場合の予定の確認用のメールテンプレート。
    SchedulerUnauthenticatedUserEngagementChannelEmailTemplateForThirdParty
    サードパーティビデオアプリケーションでエンゲージメントチャネルを使用して予定がスケジュールされている場合の予定の確認用のメールテンプレート。
  5. 変更内容を保存します。

次に、Apex クラスを使用してメール通知を送信する Apex アクションを作成します。

 
読み込み中
Salesforce Help | Article