fix(workflow): label manual trigger record output as Record/Records (#21832)

## What

The manual trigger output schema exposed the triggering record(s) under
a node labeled **Payload**. Relabels it to match what the node actually
contains:

- **Single-record** availability → **Record**
- **Bulk-records** availability → **Records**

## Why

"Payload" was a misnomer — the node holds the record(s) that triggered
the workflow. This is a display-label-only change.

## Notes for reviewers

- **No migration.** The persisted output schema key stays `payload`, so
existing variable references (`{{trigger.payload.x}}`) are unaffected.
- The front recomputes the output schema on the fly
(`computeStepOutputSchema`), so the variable picker shows the new labels
immediately, including for existing triggers.
- The backend (`workflow-schema.workspace-service`) is updated to match
for newly persisted/re-saved schemas. Previously persisted schemas keep
"Payload" until re-saved.
- Added `WORKFLOW_TRIGGER_RECORD_LABEL` /
`WORKFLOW_TRIGGER_RECORDS_LABEL` and removed the now-unused
`WORKFLOW_TRIGGER_PAYLOAD_LABEL`.
- Unit tests updated for both single and bulk cases (55/55 passing).

<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/twentyhq/twenty/pull/21832?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
This commit is contained in:
Thomas Trompette
2026-06-19 12:36:14 +02:00
committed by GitHub
parent 8f7d7101ff
commit 4075018834
7 changed files with 17 additions and 9 deletions
@@ -199,7 +199,7 @@ describe('computeStepOutputSchema', () => {
expect((result as any).payload).toMatchObject({
isLeaf: false,
label: 'Payload',
label: 'Record',
});
expect((result as any).payload.value).toHaveProperty(
'_outputSchemaType',
@@ -223,6 +223,10 @@ describe('computeStepOutputSchema', () => {
objectMetadataItems: [mockCompanyObjectMetadataItem],
});
expect((result as any).payload).toMatchObject({
isLeaf: false,
label: 'Records',
});
expect((result as any).payload.value).toHaveProperty('companies');
expect((result as any).payload.value.companies).toMatchObject({
isLeaf: true,
@@ -15,7 +15,8 @@ import {
buildManualTriggerMetadataNode,
WORKFLOW_TRIGGER_METADATA_KEY,
WORKFLOW_TRIGGER_PAYLOAD_KEY,
WORKFLOW_TRIGGER_PAYLOAD_LABEL,
WORKFLOW_TRIGGER_RECORD_LABEL,
WORKFLOW_TRIGGER_RECORDS_LABEL,
} from 'twenty-shared/workflow';
import { DatabaseEventAction } from '~/generated-metadata/graphql';
@@ -130,7 +131,7 @@ export const computeStepOutputSchema = ({
[WORKFLOW_TRIGGER_PAYLOAD_KEY]: {
isLeaf: false,
icon: objectMetadataItem.icon ?? undefined,
label: WORKFLOW_TRIGGER_PAYLOAD_LABEL,
label: WORKFLOW_TRIGGER_RECORD_LABEL,
value: generateRecordOutputSchema(objectMetadataItem),
},
[WORKFLOW_TRIGGER_METADATA_KEY]: buildManualTriggerMetadataNode(),
@@ -142,7 +143,7 @@ export const computeStepOutputSchema = ({
[WORKFLOW_TRIGGER_PAYLOAD_KEY]: {
isLeaf: false,
type: 'object',
label: WORKFLOW_TRIGGER_PAYLOAD_LABEL,
label: WORKFLOW_TRIGGER_RECORDS_LABEL,
value: {
[objectMetadataItem.namePlural]: {
isLeaf: true,