1. トークン

パイプラインプロセッサを作成して、カスタムパーソナライゼーショントークンのフォームデータを変換します

Version:
日本語翻訳に関する免責事項

このページの翻訳はAIによって自動的に行われました。可能な限り正確な翻訳を心掛けていますが、原文と異なる表現や解釈が含まれる場合があります。正確で公式な情報については、必ず英語の原文をご参照ください。

EXMを設定して、顧客がサイトからフォームに入力して送信した後に、自動メール キャンペーンを開始できます。ただし、元のフォーム フィールドの値を別の形式に変換して、レンダリングされた電子メール メッセージで カスタムの個人用設定トークン として使用することもできます。

次の例では、パイプライン プロセッサはチェック ボックス リスト フィールドの値を変換し、コンマ区切り値のリストとしてレンダリングします。どのタイプのフォームコントロールにも同じロジックを使用できます。

新しいパイプライン プロセッサを実装するには:

  1. CheckBoxListViewModelフィールドをチェックし、フィールドの元の値をList<string>からカンマ区切りの文字列に変換し、TransformedTokenValueプロパティ値を設定するTransformCheckboxListプロセッサを実装します。

    public class TransformCheckboxList : Sitecore.EmailCampaign.Cd.Pipelines.TransformFormsCustomToken.ITransformFormsCustomTokenProcessor
        {
            public void Process(Sitecore.EmailCampaign.Cd.Pipelines.TransformFormsCustomToken.TransformFormsCustomTokenArgs args)
            {
                if (args == null)
                {
                    throw new ArgumentException();
                }
    
                if (args.Field is Sitecore.ExperienceForms.Mvc.Models.Fields.CheckBoxListViewModel checkBoxListViewModel)
                {
                    List<string> checkboxListValues = checkBoxListViewModel.Value;
    
                    args.TransformedTokenValue = string.Join(", ", checkboxListValues);
                }
            }
        }
  2. Sitecore構成にパッチを適用して、transformFormsCustomTokenパイプラインに実装されたプロセッサを含めます。

     	<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:role="http://www.sitecore.net/xmlconfig/role/">
        <sitecore role:require="Standalone or ContentDelivery">
            <pipelines>
    
                <group groupName="exm.sendEmailSubmitAction">
                    <pipelines>
                        <transformFormsCustomToken>
                            <!-- Transforms the checkbox list field value from a List<string> to a comma separated string -->
                            <processor type="Sitecore.EmailCampaign.Samples.FormsIntegration.Pipelines.TransformFormsCustomToken.TransformCheckboxList, Sitecore.EmailCampaign.Samples.FormsIntegration" />
                        </transformFormsCustomToken>
                    </pipelines>
                </group>
    
            </pipelines>
        </sitecore>
    </configuration>
この記事を改善するための提案がある場合は、 お知らせください!