アクティビティタイプパラメータ
このページの翻訳は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が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", "noreply@sitecore.net" } } };
!注この例では、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
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 } } } }