diff --git a/src/Altinn.App.Api/Controllers/InstancesController.cs b/src/Altinn.App.Api/Controllers/InstancesController.cs index f1358d977..603d60093 100644 --- a/src/Altinn.App.Api/Controllers/InstancesController.cs +++ b/src/Altinn.App.Api/Controllers/InstancesController.cs @@ -335,10 +335,6 @@ public async Task> Post( // create the instance instance = await _instanceClient.CreateInstance(org, app, instanceTemplate); - foreach (var instanceEvent in result.ProcessStateChange?.Events ?? []) - { - instanceEvent.InstanceId = instance.Id; - } } catch (Exception exception) { @@ -570,10 +566,6 @@ [FromBody] InstansiationInstance instansiationInstance } instance = await _instanceClient.CreateInstance(org, app, instanceTemplate); - foreach (var instanceEvent in processResult.ProcessStateChange?.Events ?? []) - { - instanceEvent.InstanceId = instance.Id; - } if (isCopyRequest && source is not null) { @@ -691,10 +683,6 @@ [FromRoute] Guid instanceGuid ProcessChangeResult startResult = await _processEngine.GenerateProcessStartEvents(processStartRequest); targetInstance = await _instanceClient.CreateInstance(org, app, targetInstance); - foreach (var instanceEvent in startResult.ProcessStateChange?.Events ?? []) - { - instanceEvent.InstanceId = targetInstance.Id; - } await CopyDataFromSourceInstance(application, targetInstance, sourceInstance); diff --git a/src/Altinn.App.Core/Infrastructure/Clients/Storage/InstanceClient.cs b/src/Altinn.App.Core/Infrastructure/Clients/Storage/InstanceClient.cs index dbe162eea..085c83933 100644 --- a/src/Altinn.App.Core/Infrastructure/Clients/Storage/InstanceClient.cs +++ b/src/Altinn.App.Core/Infrastructure/Clients/Storage/InstanceClient.cs @@ -168,6 +168,9 @@ public async Task UpdateProcessAndEvents(Instance instance, List