Loading
Salesforce から送信されるメールは、承認済ドメインからのみとなります続きを読む
Marketing Cloud Engagement でのクロスクラウド製品の使用
目次
絞り込み条件を選択

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

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

          Salesforce ヘルプ全体を検索
          一括送信のカスタムパーソナライズインタラクションの例

          一括送信のカスタムパーソナライズインタラクションの例

          以下の一般的な使用事例を参考に、一括送信用にカスタムパーソナライズインタラクションを設定します。

          例 1: 役職を含むカスタム件名行

          この一括送信カスタムパーソナライズインタラクションの例では、ユーザーがカスタム件名を指定してデフォルトの件名を上書きできるようにします。この例では、連絡先またはリードの名、姓、役職をカスタム件名に追加します。Marketing Cloud Engagement データエクステンションとプロファイル属性にカスタム件名のエントリがあります。この例では customSubjectLine フィールドを使用します。

          Marketing Cloud Engagement で、メールを編集し、動的件名を選択します。件名の下にある稲妻アイコンをクリックします。デフォルトの件名を指定して、ルールを作成します。この新しいルールの件名は「%%customSubjectLine%%」です。customSubjectLine プロファイル属性をフィルターにドラッグして、[次の値と等しい] を [空ではない] に変更します。すべての変更を保存し、メールを保存します。

          この例では、Apex クラスは BulkSendCustomTitleCPI.cls です。

          
          // This plugin assumes a column is created on the DM Entry Source DE with "customSubjectLine"
          // It returns a Map<String, Map<String, String>> which is the approval.objectId mapped to the key / value pairs 
          // that belong to your CPI, and the keys should map to DE Entry Source DE columns if you add more.
          global class BulkSendCustomTitleCPI implements mcdm_15.BulkSendPlugin {
              global static Map<String, Map<String, String>> getBulkSendPluginData(List<mcdm_15.JourneyApproval> approvals, Map<String, String> pluginData) {
                  Map<String, Map<String, String>> IdsToCustomData = new Map<String, Map<String, String>>();
                  Map<String, String> processedCustomData = new Map<String, String>();
                  // Custom data passed in from front end component
                  String key = 'customSubjectLine';
          
                  // Here we get the title map from the contact / lead in context for each approval in the approvals list
                  processedCustomData = getTitle(approvals);
          
                  if (pluginData.size() > 0 && pluginData.get(key) != null && pluginData.get(key) != '') {
                      for (mcdm_15.JourneyApproval approval : approvals) {
                          Map<String, String> titleMap = new Map<String, String>();
                          
                          // Here we build the custom title which is title of the contact / lead + first name + last name + the value passed in from front end component
                          // ex: Doctor John Doe, We are happy to have you!
                          // Doctor is the title of John Doe contact
                          // "We Are happy to have you!" is the custom text passed in
                          titleMap.put(key, processedCustomData.get(approval.objectId) + ' ' + approval.campaignMemberFields.get('FirstName') + ' ' + approval.campaignMemberFields.get('LastName') + ', ' + pluginData.get(key));
                          IdsToCustomData.put(approval.objectId, titleMap);
                      }
                  } else {
                      // If no input is provided from the front end component, show a default title
                      for (mcdm_15.JourneyApproval approval : approvals) {
                          Map<String, String> titleMap = new Map<String, String>();
                          titleMap.put(key, 'No Input from Bulk CPI');
                          IdsToCustomData.put(approval.objectId, titleMap);
                      }
                  }        
                  
                  // Return a map of approval object IDs to the custom data map of customSubjectLine -> value
                  return IdsToCustomData;
              }
              
              // In this example, we get the title for each contact
              private static Map<String, String> getTitle(List<mcdm_15.JourneyApproval> approvals) {
                  Map<String, String> approvalsToTitle = new Map<String, String>();
                  List<String> contactIds = new List<String>();
                  List<String> leadIds = new List<String>();
                  
                  // Get the contact and lead IDs from the JourneyApproval records passed in
                  for (mcdm_15.JourneyApproval approval : approvals) {
                      if (approval.objectType == Schema.SObjectType.Contact.getName()) {
                          contactIds.add(approval.objectId);
                      } else if (approval.objectType == Schema.SObjectType.Lead.getName()) {
                          leadIds.add(approval.objectId);
                      }
                  }
          
                  if (contactIds.size() > 0) {
                      if (Limits.getQueries() == Limits.getLimitQueries()) {
                          // Example of throwing a custom exception to handle govener limits in this custom plugin class
                          throw new mcdm_15.BulkSendCustomPluginException('SOQL limit of ' + Limits.getLimitQueries() + ' reached.');
                      }
                      
                      // Get the title and return the map of contactId to title
                      List<Contact> contacts = [SELECT Id, Title FROM Contact WHERE Id IN :contactIds];
                      for (Contact contact : contacts) {
                          approvalsToTitle.put(contact.Id, contact.Title == null ? '' : contact.Title);
                      }
                  }
          
                  if (leadIds.size() > 0) {
                      if (Limits.getQueries() == Limits.getLimitQueries()) {
                          // Example of throwing a custom exception to handle govener limits in this custom plugin class
                          throw new mcdm_15.BulkSendCustomPluginException('SOQL limit of ' + Limits.getLimitQueries() + ' reached.');
                      }
                      
                      // Get the title and return the map of contactId to title
                      List<Lead> leads = [SELECT Id, Title FROM Lead WHERE Id IN :leadIds];
                      for (Lead lead : leads) {
                          approvalsToTitle.put(lead.Id, lead.Title == null ? '' : lead.Title);
                      }
                  }
          
                  return approvalsToTitle;
              }
          }

          ここで、Aura コンポーネントは BulkSendCustomTitleCPI.cmp です。

          <aura:component access="GLOBAL" implements="mcdm_15:MessagePersonalizationHandler" controller="BulkSendCustomTitleCPI">
              <aura:attribute access="GLOBAL" name="personalizationReadyHandler" type="Aura.Action" default="{!c.messagePersonalizationReady}"/>
              <aura:attribute name="customSubjectLine" access="private" type="String" description="Custom subject line used in bulk CPI logic"/>
              <aura:attribute name="selectedMembers" access="private" type="Object[]" description="The currently selected member"/>
              <aura:handler name="init" value="{!this}" action="{!c.init}"/>
              <lightning:spinner variant="brand" size="large" aura:id="mySpinner"/>
              <div class="slds-card">
                  <div class="slds-card__header">
                      <div class="slds-media slds-media_center">
                          <div class="slds-media__figure">
                              <lightning:icon iconName="custom:custom24" size="large"/>
                          </div>
                          <div class="slds-media__body">
                              <p class="slds-text-heading_small">Bulk CPI - Custom subject demo</p>
                          </div>
                      </div>
                  </div>
                  <div class="slds-card__body slds-card__body_inner">
                      <div>
                          <p class="slds-text-title slds-text-align_center">'{!v.selectedMembers.length}' user(s) selected</p>
                      </div>
                      <div class="slds-m-around_medium">
                          <lightning:input class="slds-m-bottom_small" label="customSubjectLine" value="{!v.customSubjectLine}" onchange="{!c.handleInputChanged}"/>
                      </div>
                  </div>
              </div>
          </aura:component>

          ここで、Aura コンポーネントコントローラーは BulkSendCustomTitleCPI.js です。

          ({
              init: function(cmp) {
                  cmp.set('v.selectedMembers', []);
              },
          
              messagePersonalizationReady: function(cmp, event) {
                  var selectedMembers = event.getParam('arguments').members;
                  var customData = event.getParam('arguments').customData;
                  cmp.set('v.selectedMembers', selectedMembers);
          
                  if (selectedMembers.length) {
                      var data = selectedMembers[0].customData || {};
                      cmp.set('v.customSubjectLine', data.customSubjectLine || '');
                  } else if (customData != null) {
                      var data = customData.autosend || {};
                      cmp.set('v.customSubjectLine', data.customSubjectLine || '');
                  }
          
                  var spinner = cmp.find('mySpinner');
                  $A.util.addClass(spinner, 'slds-hide');
              },
          
              handleInputChanged: function(cmp) {
                  // Get the data set from the component in the modal to pass to the 
                  // apex class for bulk send CPI, this will be appended to the logic
                  // performed in the apex class.
                  var data = {
                      customSubjectLine: cmp.get('v.customSubjectLine')
                  };
          
                  var selectedMembers = cmp.get('v.selectedMembers'),
                      id,
                      dataProvidedEvent;
          
                  if (selectedMembers.length) {
                      selectedMembers.forEach(function(member) {
                          dataProvidedEvent = $A.get('e.mcdm_15:JourneyApprovalsDataProvided');
                          // Handles campaign vs quick send object IDs for preview updates
                          id = member.campaignMemberId || member.objectId;
                          dataProvidedEvent.setParams({
                              id: id,
                              data: data
                          });
                          dataProvidedEvent.fire();
                      });
                  } else {
                      dataProvidedEvent = $A.get('e.mcdm_15:JourneyApprovalsDataProvided');
                      // Supports autosend flow
                      dataProvidedEvent.setParams({
                          id: 'autosend',
                          data: data
                      });
                      dataProvidedEvent.fire();
                  }
              }
          })

          この匿名 Apex コードを使用して登録します。

          SObject mapping = new mcdm_15__JourneyApprovalsPlugin__c(
              mcdm_15__Component_Name__c='c:BulkSendCustomTitleCPI',
              mcdm_15__ApexClassName__c = 'BulkSendCustomTitleCPI',
              mcdm_15__IsBulkSendPlugin__c = true);
          
          insert mapping;
           
          読み込み中
          Salesforce Help | Article