diff --git a/src/modules/Elsa.Workflows.Management/Mappers/WorkflowStateMapper.cs b/src/modules/Elsa.Workflows.Management/Mappers/WorkflowStateMapper.cs index cea8e3a2a..deccb8170 100644 --- a/src/modules/Elsa.Workflows.Management/Mappers/WorkflowStateMapper.cs +++ b/src/modules/Elsa.Workflows.Management/Mappers/WorkflowStateMapper.cs @@ -1,3 +1,4 @@ +using Elsa.Extensions; using Elsa.Workflows.Management.Entities; using Elsa.Workflows.State; @@ -8,6 +9,12 @@ namespace Elsa.Workflows.Management.Mappers; /// public class WorkflowStateMapper { + /// + /// [Obsolete] The property key name used to store the workflow instance name. + /// + [Obsolete("This constant is obsolete and retained only for backward compatibility. Avoid using it in new code.")] + private const string WorkflowInstanceNameKey = "WorkflowInstanceName"; + /// /// Maps a workflow state to a workflow instance. /// @@ -43,6 +50,10 @@ public class WorkflowStateMapper target.UpdatedAt = source.UpdatedAt; target.FinishedAt = source.FinishedAt; target.WorkflowState = source; + + // Keep for backward compatibility with workflow instances created before the introduction of the Name property. + if (source.Properties.TryGetValue(WorkflowInstanceNameKey, out var name)) + target.Name = name; } ///