diff --git a/packages/twenty-server/src/engine/twenty-orm/repository/workspace-update-query-builder.ts b/packages/twenty-server/src/engine/twenty-orm/repository/workspace-update-query-builder.ts index 96710abccb..eecee5f874 100644 --- a/packages/twenty-server/src/engine/twenty-orm/repository/workspace-update-query-builder.ts +++ b/packages/twenty-server/src/engine/twenty-orm/repository/workspace-update-query-builder.ts @@ -236,10 +236,7 @@ export class WorkspaceUpdateQueryBuilder< const results: UpdateResult[] = []; for (const input of this.manyInputs) { - this.expressionMap.valuesSet = formatData( - input.partialEntity, - objectMetadata, - ); + this.expressionMap.valuesSet = input.partialEntity; this.where({ id: input.criteria }); const nestedRelationQueryBuilder = new WorkspaceSelectQueryBuilder( @@ -250,6 +247,12 @@ export class WorkspaceUpdateQueryBuilder< this.authContext, ); + this.relationNestedConfig = + this.relationNestedQueries.prepareNestedRelationQueries( + input.partialEntity as QueryDeepPartialEntityWithNestedRelationFields, + mainAliasTarget, + ); + if (isDefined(this.relationNestedConfig)) { const updatedValues = await this.relationNestedQueries.processRelationNestedQueries({ @@ -388,14 +391,15 @@ export class WorkspaceUpdateQueryBuilder< ): this { const mainAliasTarget = this.getMainAliasTarget(); - this.relationNestedConfig = - this.relationNestedQueries.prepareNestedRelationQueries( - inputs.map( - (input) => input.partialEntity, - ) as QueryDeepPartialEntityWithNestedRelationFields[], - mainAliasTarget, - ); - this.manyInputs = inputs; + const objectMetadata = getObjectMetadataFromEntityTarget( + mainAliasTarget, + this.internalContext, + ); + + this.manyInputs = inputs.map((input) => ({ + criteria: input.criteria, + partialEntity: formatData(input.partialEntity, objectMetadata), + })); return this; }