From 5695202d310f50d21074b8fc63a8cbc1ec46d87b Mon Sep 17 00:00:00 2001 From: Thomas Trompette Date: Tue, 16 Sep 2025 18:07:36 +0200 Subject: [PATCH] Fix variables coming from DB events (#14545) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the case of DB events, id field will be prefixed with 'property.after'. This is why we need to use the fieldIdName when provided. Before: When providing only id, Company variable is {{trigger.id}}. Which does not exists on DB event output schema Capture d’écran 2025-09-16 à 17 57
42 After: Company variable is {{trigger.property.after.id}} Capture d’écran 2025-09-16 à 17 57
14 --- .../components/WorkflowVariablesDropdownStepItems.tsx | 2 +- .../workflow/workflow-variables/types/RecordOutputSchemaV2.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx index 0b14c171722..f63191ac2fb 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/components/WorkflowVariablesDropdownStepItems.tsx @@ -73,7 +73,7 @@ export const WorkflowVariablesDropdownStepItems = ({ onSelect( getVariableTemplateFromPath({ stepId: step.id, - path: [...currentPath, 'id'], + path: [...currentPath, currentSubStep.object.fieldIdName ?? 'id'], }), ); }; diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/types/RecordOutputSchemaV2.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/types/RecordOutputSchemaV2.ts index 236c232812f..b6db5367cca 100644 --- a/packages/twenty-front/src/modules/workflow/workflow-variables/types/RecordOutputSchemaV2.ts +++ b/packages/twenty-front/src/modules/workflow/workflow-variables/types/RecordOutputSchemaV2.ts @@ -28,6 +28,7 @@ export type RecordOutputSchemaV2 = { label: string; objectMetadataId: string; isRelationField?: boolean; + fieldIdName?: string; }; fields: Record; _outputSchemaType: 'RECORD';