From eb2e978b6510dca2d8c3c3524cf3d67579c1e509 Mon Sep 17 00:00:00 2001 From: "macroscopeapp[bot]" <170038800+macroscopeapp[bot]@users.noreply.github.com> Date: Fri, 29 May 2026 08:55:57 +0000 Subject: [PATCH] fix(workflow-executor): restore field names in fetchXToOneCandidate before accessing relation --- .../src/executors/load-related-record-step-executor.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/workflow-executor/src/executors/load-related-record-step-executor.ts b/packages/workflow-executor/src/executors/load-related-record-step-executor.ts index 788c9a9723..be040e0228 100644 --- a/packages/workflow-executor/src/executors/load-related-record-step-executor.ts +++ b/packages/workflow-executor/src/executors/load-related-record-step-executor.ts @@ -303,7 +303,15 @@ export default class LoadRelatedRecordStepExecutor extends RecordStepExecutor | null | undefined; + // Restore field names from camelCase to original format (e.g., snake_case) so that + // relations with underscores in their names (e.g., `customer_order`) are correctly accessed. + const sourceSchema = await this.getCollectionSchema(target.selectedRecordRef.collectionName); + const restoredValues = restoreFieldNames( + parent.values, + sourceSchema.fields.map(f => f.fieldName), + ); + + const relation = restoredValues[target.name] as Record | null | undefined; const packedId = relation?.id as string | undefined; if (!packedId) {