Table of Contents

Class AutomationProcessContext

Namespace
CMS.Automation
Assembly
CMS.Automation.dll

Provides context data for automation action execution.

public sealed class AutomationProcessContext
Inheritance
object
AutomationProcessContext
Extension Methods

Properties

Process

Metadata describing the automation process executing the automation action.

public AutomationProcessMetadata Process { get; }

Property Value

AutomationProcessMetadata

Methods

GetProcessData<T>(CancellationToken)

Retrieves custom process data of the specified type that has been persisted across automation steps.

public Task<T> GetProcessData<T>(CancellationToken cancellationToken = default) where T : class, IAutomationProcessData

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<T>

The deserialized data, or null when no entry exists for the type or when the stored value cannot be deserialized.

Type Parameters

T

Type representing the custom process data. Must implement IAutomationProcessData.

Remarks

Deserialization failures are logged at debug level; the next call to SetProcessData<T>(T, CancellationToken) overwrites the malformed entry.

GetTriggerData<T>(CancellationToken)

Gets the trigger data captured when the process started, typed as T.

public Task<T> GetTriggerData<T>(CancellationToken cancellationToken = default) where T : IAutomationTriggerData

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<T>

The trigger data when it is a T; otherwise null when no trigger data was captured or the captured data is not a T.

Type Parameters

T

Expected trigger data type. Use IAutomationTriggerData to get the raw value and check its type manually.

GetTriggerIdentifier(CancellationToken)

Gets the identifier of the trigger that started the process.

public Task<string> GetTriggerIdentifier(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Cancellation token.

Returns

Task<string>

SetProcessData<T>(T, CancellationToken)

Stores custom process data that persists across automation steps for the current process.

public Task SetProcessData<T>(T data, CancellationToken cancellationToken = default) where T : class, IAutomationProcessData

Parameters

data T

The data to store.

cancellationToken CancellationToken

Cancellation token.

Returns

Task

Type Parameters

T

Type representing the custom process data. Must implement IAutomationProcessData.

Exceptions

ArgumentNullException

Thrown when data is null.