DataWeb
Search Results for

    Show / Hide Table of Contents

    Class AutomationTask

    Base class for automation tasks.

    Inheritance
    object
    AutomationTask
    AutomationTaskBasic
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Automation
    Assembly: DataWeb.Core.dll
    Syntax
    public abstract class AutomationTask
    Remarks

    Creates a new instance of the AutomationTask class.

    Constructors

    AutomationTask(IAutomationEventService, IAutomationProfileService, IServiceProvider)

    Base class for automation tasks.

    Declaration
    protected AutomationTask(IAutomationEventService automationEventService, IAutomationProfileService automationProfileService, IServiceProvider serviceProvider)
    Parameters
    Type Name Description
    IAutomationEventService automationEventService

    The automation service.

    IAutomationProfileService automationProfileService
    IServiceProvider serviceProvider

    The service provider.

    Remarks

    Creates a new instance of the AutomationTask class.

    Fields

    serviceProvider

    Declaration
    protected readonly IServiceProvider serviceProvider
    Field Value
    Type Description
    IServiceProvider

    Properties

    Description

    The description of the automation task.

    Declaration
    public string Description { get; set; }
    Property Value
    Type Description
    string

    ExecutionEndDate

    The date and time when the execution of the task ended, if available.

    Declaration
    public DateTimeOffset? ExecutionEndDate { get; set; }
    Property Value
    Type Description
    DateTimeOffset?

    ExecutionSettings

    The execution settings of the automation task.

    Declaration
    public AutomationTask.TaskExecutionSettings ExecutionSettings { get; set; }
    Property Value
    Type Description
    AutomationTask.TaskExecutionSettings

    ExecutionStartDate

    The date and time when the execution of the task started, if available.

    Declaration
    public DateTimeOffset? ExecutionStartDate { get; set; }
    Property Value
    Type Description
    DateTimeOffset?

    IdMaster

    Gets or sets the unique identifier.

    Declaration
    public string IdMaster { get; set; }
    Property Value
    Type Description
    string

    Name

    The name of the automation task.

    Declaration
    public string Name { get; set; }
    Property Value
    Type Description
    string

    SandboxSettings

    The sandbox settings of the automation task.

    Declaration
    public AutomationTask.TaskSandboxSettings SandboxSettings { get; set; }
    Property Value
    Type Description
    AutomationTask.TaskSandboxSettings

    ScenarioIdMaster

    Gets or sets the parent scenario identifier.

    Declaration
    public string ScenarioIdMaster { get; set; }
    Property Value
    Type Description
    string

    ScheduleSettings

    The schedule settings of the automation task.

    Declaration
    public AutomationTask.TaskScheduleSettings ScheduleSettings { get; set; }
    Property Value
    Type Description
    AutomationTask.TaskScheduleSettings

    Status

    The current status of the automation task.

    Declaration
    public AutomationTaskStatus Status { get; set; }
    Property Value
    Type Description
    AutomationTaskStatus

    TriggerSettings

    The trigger settings of the automation task.

    Declaration
    public AutomationTask.TaskTriggerSettings TriggerSettings { get; set; }
    Property Value
    Type Description
    AutomationTask.TaskTriggerSettings

    Methods

    EvaluateProfileComputedPropertyAsync(EventParameter, AutomationEvent, AutomationProfile, CancellationToken)

    Evaluates a computed profile property used by trigger profile parameters.

    Declaration
    public virtual Task<bool> EvaluateProfileComputedPropertyAsync(AutomationTask.EventParameter profileParameter, AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationTask.EventParameter profileParameter

    The profile parameter containing the computed property definition to evaluate.

    AutomationEvent triggerEvent

    The automation event that triggered evaluation (provides event parameters and context).

    AutomationProfile automationProfile

    The automation profile to evaluate against.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task<bool>

    A task that completes with true if the computed property evaluation succeeds (parameter matches), otherwise false.

    EvaluateTriggerEventAsync(AutomationEvent, CancellationToken)

    Evaluates whether the specified automation trigger event meets the conditions for executing the task, based on trigger mode restrictions (e.g., OncePerDay), inclusion and exclusion events, and user profile parameters. If the conditions are not met, the task is discarded and a reason is provided.

    Declaration
    public virtual Task<AutomationTask.EvaluateEventResult> EvaluateTriggerEventAsync(AutomationEvent triggerEvent, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event used to trigger evaluation.

    CancellationToken cancellationToken

    A token to observe while waiting for the task to complete.

    Returns
    Type Description
    Task<AutomationTask.EvaluateEventResult>

    A task representing the asynchronous operation, with an AutomationTask.EvaluateEventResult indicating whether the trigger was valid and, if not, why it was rejected.

    ExecuteTriggerEventAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Execute the automation task for the specified trigger event.

    Declaration
    public virtual Task ExecuteTriggerEventAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The AutomationEvent to process.

    AutomationProfile automationProfile

    The AutomationProfile to process.

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    GetCustomAttributionGoalEventsAsync(DateTime, DateTime, CancellationToken)

    Asynchronously retrieves the list of AutomationEvent related to custom attribution goals within the specified date range.

    Declaration
    public Task<List<AutomationEvent>> GetCustomAttributionGoalEventsAsync(DateTime dateStart, DateTime dateEnd, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime dateStart

    The start date of the search range.

    DateTime dateEnd

    The end date of the search range.

    CancellationToken cancellationToken

    Optional token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<List<AutomationEvent>>

    A Task<TResult> representing the asynchronous operation, containing a list of AutomationEvent.

    GetEmailBodyAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Builds the full HTML body of the email using a template, localized content, and dynamic placeholders.

    Declaration
    public virtual Task<string> GetEmailBodyAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the processed email body as HTML.

    GetEmailLinkUrlAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Retrieves the URL to be used as the main link in the email, with localization and placeholder replacements.

    Declaration
    public virtual Task<string> GetEmailLinkUrlAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the localized and processed link URL.

    GetEmailSubjectAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Retrieves the subject line for the email notification, with localization and placeholder replacements.

    Declaration
    public virtual Task<string> GetEmailSubjectAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the localized and processed email subject.

    GetEmailTextAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Retrieves the main text content to be injected into the email, with localization and placeholder replacements.

    Declaration
    public virtual Task<string> GetEmailTextAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the localized and processed email text.

    GetMessageLinkUrlAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Retrieves the link URL to be used in the in-app message notification, with localization and placeholder replacement.

    Declaration
    public virtual Task<string> GetMessageLinkUrlAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the localized and processed link URL.

    GetMessageTextAsync(AutomationEvent, AutomationProfile, string, CancellationToken)

    Retrieves the message text to be displayed in the app notification, including localization, placeholders, and link replacement.

    Declaration
    public virtual Task<string> GetMessageTextAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, string linkUrl, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    string linkUrl

    The URL to be included in the message text (e.g. for redirection).

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the localized and processed message text.

    GetMessageTitleAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Retrieves the title to be used for the in-app message notification, with localization and placeholder replacement.

    Declaration
    public virtual Task<string> GetMessageTitleAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing localization and user information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task<string>

    A task containing the localized and processed message title.

    GetPeriodAttributionGoalEventsAsync(DateTime, DateTime, CancellationToken)

    Retrieves goal events that occurred within the specified period and filters them based on the configured goal attribution model.

    Declaration
    public virtual Task<IEnumerable<AutomationEvent>> GetPeriodAttributionGoalEventsAsync(DateTime dateStart, DateTime dateEnd, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime dateStart

    The start date of the period to evaluate.

    DateTime dateEnd

    The end date of the period to evaluate.

    CancellationToken cancellationToken

    Optional cancellation token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<IEnumerable<AutomationEvent>>

    A collection of AutomationEvent instances that meet the attribution criteria for the given time range.

    GetPeriodExecutedEventCountAsync(DateTime, DateTime, CancellationToken)

    Retrieves execution events count related to the current task that occurred within the specified time period.

    Declaration
    public virtual Task<long> GetPeriodExecutedEventCountAsync(DateTime dateStart, DateTime dateEnd, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime dateStart

    The start date of the period to retrieve events for.

    DateTime dateEnd

    The end date of the period to retrieve events for.

    CancellationToken cancellationToken

    Optional cancellation token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<long>

    A collection of AutomationEvent instances representing task executions during the specified time range.

    GetPeriodExecutedEventsAsync(DateTime, DateTime, CancellationToken)

    Retrieves all execution events related to the current task that occurred within the specified time period.

    Declaration
    public virtual Task<IEnumerable<AutomationEvent>> GetPeriodExecutedEventsAsync(DateTime dateStart, DateTime dateEnd, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime dateStart

    The start date of the period to retrieve events for.

    DateTime dateEnd

    The end date of the period to retrieve events for.

    CancellationToken cancellationToken

    Optional cancellation token to cancel the asynchronous operation.

    Returns
    Type Description
    Task<IEnumerable<AutomationEvent>>

    A collection of AutomationEvent instances representing task executions during the specified time range.

    GetPeriodGoalEventsAsync(DateTime, DateTime, CancellationToken)

    Asynchronously retrieves a collection of automation events that are considered goals, based on the execution settings and the specified date range.

    Declaration
    public virtual Task<IEnumerable<AutomationEvent>> GetPeriodGoalEventsAsync(DateTime dateStart, DateTime dateEnd, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    DateTime dateStart

    The start date of the time range for event filtering.

    DateTime dateEnd

    The end date of the time range for event filtering.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task<IEnumerable<AutomationEvent>>

    A task representing the asynchronous operation, containing an enumerable of AutomationEvent that match the goal criteria within the specified time frame.

    GetTriggerEventAsync(string, CancellationToken)

    Asynchronously retrieves the first automation event that matches the specified trigger settings and event ID.

    Declaration
    public virtual Task<AutomationEvent> GetTriggerEventAsync(string triggerEventId, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string triggerEventId

    The unique identifier of the trigger event to retrieve.

    CancellationToken cancellationToken

    A token to cancel the asynchronous operation (optional).

    Returns
    Type Description
    Task<AutomationEvent>

    A task that represents the asynchronous operation. The task result contains the first matching AutomationEvent or null if no matching event is found.

    GetTriggerEventsAsync(int, CancellationToken)

    Asynchronously retrieves a collection of automation trigger events based on the current trigger settings.

    Declaration
    public virtual Task<IEnumerable<AutomationEvent>> GetTriggerEventsAsync(int count = 1000, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    int count

    The maximum number of events to retrieve. Defaults to 1000.

    CancellationToken cancellationToken

    A token to monitor for cancellation requests.

    Returns
    Type Description
    Task<IEnumerable<AutomationEvent>>

    A task representing the asynchronous operation, with a result of an enumerable collection of AutomationEvent objects that match the filter criteria defined by the trigger settings.

    ProcessOnAppNotificationSaveAsync(AppNotification, AppIdentityUser, AutomationEvent, AutomationProfile, CancellationToken)

    Processes logic when an app notification is saved during an automation flow.

    Declaration
    public virtual Task ProcessOnAppNotificationSaveAsync(AppNotification appNotification, AppIdentityUser identityUser, AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AppNotification appNotification

    The app notification being saved.

    AppIdentityUser identityUser

    The user associated with the app notification.

    AutomationEvent triggerEvent

    The automation event that triggered this step.

    AutomationProfile automationProfile

    The automation profile being executed.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A completed task representing the asynchronous operation.

    ProcessOnExecuteCompleteAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Processes logic when the execution of an automation is complete.

    Declaration
    public virtual Task ProcessOnExecuteCompleteAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the execution.

    AutomationProfile automationProfile

    The automation profile that has completed execution.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A completed task representing the asynchronous operation.

    ProcessOnExecuteStartAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Processes logic when the execution of an automation starts.

    Declaration
    public virtual Task ProcessOnExecuteStartAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the execution.

    AutomationProfile automationProfile

    The automation profile being executed.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A completed task representing the asynchronous operation.

    SendAppNotificationAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Sends an in-app message notification as part of the automation flow, based on profile and trigger context.

    Declaration
    public virtual Task SendAppNotificationAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing recipient and context information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation of sending the app notification.

    SendEmailNotificationAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Sends an email notification as part of the automation flow.

    Declaration
    public virtual Task SendEmailNotificationAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing recipient and context information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation of sending the email notification.

    SendPhoneNotificationAsync(AutomationEvent, AutomationProfile, CancellationToken)

    Sends a phone message notification as part of the automation flow, based on profile and trigger context.

    Declaration
    public virtual Task SendPhoneNotificationAsync(AutomationEvent triggerEvent, AutomationProfile automationProfile, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    AutomationEvent triggerEvent

    The automation event that triggered the notification.

    AutomationProfile automationProfile

    The automation profile containing recipient and context information.

    CancellationToken cancellationToken

    Token to monitor for cancellation requests.

    Returns
    Type Description
    Task

    A task that represents the asynchronous operation of sending the app notification.

    In this article
    Back to top Generated by DocFX