アクティビティ・タイプ・パラメータ

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

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

アクティビティ パラメーターは、カスタム値をアクティビティに渡すためのプロパティです。アクティビティ パラメータは、次のもので構成されます。

  • アクティビティ・タイプ・クラスのパブリック・プロパティ (例:

    using Sitecore.Xdb.MarketingAutomation.Core.Activity;
    using Sitecore.Xdb.MarketingAutomation.Core.Processing.Plan;
    using Microsoft.Extensions.Logging;
    
    namespace Documentation.Examples
    {
        public class DoNothingActivity : IActivity
        {
            public IActivityServices Services { get; set; }
    
            // Parameters
            public string NoReplyAddress { get; set; }
    
            public DoNothingActivity()
            {
            }
    
            public ActivityResult Invoke(IContactProcessingContext context)
            {
                // This activity does nothing
                return new SuccessMove();
            }
        }
    }
  • アクティビティの種類記述子の下のパラメーター項目。例えば:

アクティビティ・タイプ・パラメーターの設定

メモ

次の手順は、マーケティングオートメーションUIによって実行されます。

アクティビティー・パラメーターは、自動化プラン定義マネージャーによって設定されます。 AutomationActivityDefinitionがthe DoNothingActivityタイプを使用している場合は、オプションのNoReplyAddressを渡すことができます。

次の例では、DoNothingActivityの記述子アイテムIDが {56632708-510a-46fd-995d-6a4a709e90d4}であると仮定しています。パラメータは、次のようにParametersディクショナリに渡されます。

var newActivity = new AutomationActivityDefinition
{
        Id = Guid.NewGuid(), // ID of this instance
        ActivityTypeId = Guid.Parse("56632708-510a-46fd-995d-6a4a709e90d4"),
        Name = "Do nothing activity",
        Parameters =
        {
                { "NoReplyAddress", "[email protected]" }
        }
};
手記

この例では、NoReplyAddressパラメーターがハードコードされています。オートメーション プランを作成するUIを構築する場合は、Activity Type Descriptor Locator APIを使用して、特定のアクティビティの種類で使用可能なすべてのパラメーターの一覧を取得し、ユーザーに値を指定するように求めます。

すべてのアクティビティの種類のパラメーターを取得する

Activity Type Descriptor Locator APIを使用して、特定のアクティビティの種類で使用可能なすべてのパラメーターを取得します。次の例は、特定のアクティビティの種類のすべてのパラメーターのキーと名前を取得する方法を示しています。

using System;
using Sitecore.Xdb.MarketingAutomation.Locators.AutomationPlans;
using Sitecore.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using System.Globalization;

namespace Documentation.Examples
{
    public class Locators
    {
        public void LocatorsExample()
        {
            var locatorService = ServiceLocator.ServiceProvider.GetService<IActivityDescriptorLocator>();

            var activityTypeDescriptorId = Guid.Parse("{56632708-510a-46fd-995d-6a4a709e90d4}");

            var descriptor = locatorService.GetDescriptor(activityTypeDescriptorId, CultureInfo.InvariantCulture);

            foreach (var parameter in descriptor.Parameters)
            {
                var key = parameter.Key; // Exact name of property
                var name = parameter.Name; // Human-readable name
            }
        }
    }
}
この記事を改善するための提案がある場合は、 お知らせください!