Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む
目次
絞り込み条件を選択

          結果がありません
          結果がありません
          検索のヒントをいくつかご紹介します

          キーワードの入力ミスがないか確認する。
          より一般的な検索語を使用する。
          絞り込み条件を減らして、検索範囲を広げる。

          Salesforce ヘルプ全体を検索
          保険証明メールの Apex クラスの作成

          保険証明メールの Apex クラスの作成

          Apex クラスを作成して、保険証を要求する保険契約者に添付ファイルを含むメールを送信します。

          必要なエディション

          使用可能なインターフェース: Lightning Experience
          使用可能なエディション: Financial Services Cloud と統合カタログが付属する Enterprise Edition、Unlimited Edition、および Developer Edition。
          必要なユーザー権限
          Apex クラスを作成する 「アプリケーションのカスタマイズ」
          1. [設定] をクリックし、[開発者コンソール] をクリックします。
          2. Apex クラスを作成します。

            例: 保険証を要求するユーザーに添付ファイル付きのメールを送信するには、次のようなスクリプトを使用します。

            /*************************
            * @Class Name:- FSCInsServiceProcessSendEmail
            * @Description:- This apex class contains an invocable method used to send email along with attachment
            **************************/
            global with sharing class FSCInsServiceProcessSendEmail {
            // Method to send email along with attachment and returns either Success or Failure back to flow output variable
            @InvocableMethod(label='Send Email to user with attachment' description='Sends email to user from apex ')
            public static List<String> sendEmail(List<Requests> request) {
            List<Messaging.SingleEmailMessage> mails = new List<Messaging.SingleEmailMessage>();
            Messaging.SingleEmailMessage mail = new Messaging.SingleEmailMessage();
            List<String> response = new List<String>();
            List<String> sendTo = new List<String> {request[0].sendToEmailId};
            mail.setToAddresses(sendTo);
            mail.setSubject(request[0].emailSubject);
            mail.setHtmlBody(request[0].textTemplate);
            //Fetch attachment id associated to the caseId and append it to email as attachments
            List<Attachment> attList = new List<Attachment> ([SELECT Id, Name FROM Attachment WHERE parentId =: request[0].caseId WITH SECURITY_ENFORCED]);
            if (attList.size() > 0) {
            List<String> attachmentIds = new List<String> {attList[0].Id};
            mail.setEntityAttachments(attachmentIds);
            }
            // Add email to the master list
            mails.add(mail);
            //Send all emails in the master list
            Messaging.SendEmailResult[] results = Messaging.sendEmail(mails);
            if (results[0].success) {
            response.add('Success');
            } else {
            response.add('Failed to send email');
            }
            return response;
            }
            
            //set of invocable variables which is used to set values from flow
            global class Requests {
            @InvocableVariable(label='Email Body' description='Text template of email body')
            global String textTemplate;
            @InvocableVariable(label='Send To Email Id' description='Email id of recipient')
            global String sendToEmailId;
            @InvocableVariable(label='CaseId' description='Case Id associated with attachment')
            global String caseId;
            @InvocableVariable(label='Email Subject' description='Email subject')
            global String emailSubject;
            }
            }
            
           
          読み込み中
          Salesforce Help | Article