LogoLogo
GitHub
  • Elsa Workflows 3
  • Getting Started
    • Concepts
      • Outcomes
      • Correlation ID
    • Hello World
    • Prerequisites
    • Packages
    • Containers
      • Docker
      • Docker Compose
        • Elsa Server + Studio
        • Elsa Server + Studio - Single Image
        • Persistent Database
        • Traefik
  • Application Types
    • Elsa Server
    • Elsa Studio
    • Elsa Server + Studio (WASM)
  • Guides
    • HTTP Workflows
      • Programmatic
      • Designer
    • External Application Interaction
    • Loading Workflows from JSON
    • Running Workflows
      • Using Elsa Studio
      • Using a Trigger
      • Dispatch Workflow Activity
  • Activities
    • Control Flow
      • Decision
    • MassTransit
      • Tutorial
  • Expressions
    • C#
    • JavaScript
    • Python
    • Liquid
  • Extensibility
    • Custom Activities
  • Reusable Triggers (3.5-preview)
  • Multitenancy
    • Introduction
    • Setup
  • Operate
    • Variables
    • Activation Strategies
    • Incidents
      • Strategies
      • Configuration
    • Alterations
      • Alteration Plans
        • REST API
      • Applying Alterations
        • REST API
        • Extensibility
  • Optimize
    • Log Persistence
    • Retention
  • Hosting
    • Distributed Hosting
Powered by GitBook
On this page
  • Creating Alteration Plans
  • Submitting Alteration Plans
Edit on GitHub
  1. Operate
  2. Alterations

Alteration Plans

An alteration plan represents a collection of alterations that can be applied to a workflow instance or a set of workflow instances.

Creating Alteration Plans

To create an alteration plan, create a new instance of the NewAlterationPlan class. For example:

var plan = new NewAlterationPlan
{
    Alterations = new List<IAlteration>
    {
        new ModifyVariable("MyVariable", "MyValue")
    },
    WorkflowInstanceIds = new[] { "26cf02e60d4a4be7b99a8588b7ac3bb9" } 
};

Submitting Alteration Plans

To submit an alteration plan, use the IAlterationPlanScheduler service. For example:

var scheduler = serviceProvider.GetRequiredService<IAlterationPlanScheduler>();
var planId = await scheduler.SubmitAsync(plan, cancellationToken);

When a plan is submitted, an alteration job is created for each workflow instance, to which each alteration will be applied.

Alteration plans are executed asynchronously in the background. To monitor the execution of an alteration plan, use the IAlterationPlanStore service. For example:

var store = serviceProvider.GetRequiredService<IAlterationPlanStore>();
var plan = await _alterationPlanStore.FindAsync(new AlterationPlanFilter { Id = planId }, cancellationToken);

To get the alteration jobs that were created as part of the plan, use the IAlterationJobStore service. For example:

var store = serviceProvider.GetRequiredService<IAlterationJobStore>();
var jobs = (await _alterationJobStore.FindManyAsync(new AlterationJobFilter { PlanId = planId }, cancellationToken)).ToList();
PreviousAlterationsNextREST API

Last updated 4 months ago