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) {