The open alternative to Salesforce, designed for AI.
TypeScript crmcrm-systemcustomergood-first-issuegraphqlhacktoberfestjavascriptmarketingmonoreponestjsopen-sourcepostgresqlreactreactjssalestypescriptweb
fix(workflow): label manual trigger record output as Record/Records (#21832)
Thomas Trompette407501883498
diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.tsindex a1ae7641b69..bfd28581a45 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/__tests__/computeStepOutputSchema.test.ts@@ -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,diff --git a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.ts b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.tsindex e1278301759..89d8f2532ed 100644--- a/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.ts+++ b/packages/twenty-front/src/modules/workflow/workflow-variables/utils/generate/computeStepOutputSchema.ts@@ -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,diff --git a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-schema/workflow-schema.workspace-service.ts b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-schema/workflow-schema.workspace-service.tsindex e2174e58a62..27134b74bd0 100644--- a/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-schema/workflow-schema.workspace-service.ts+++ b/packages/twenty-server/src/modules/workflow/workflow-builder/workflow-schema/workflow-schema.workspace-service.ts@@ -18,7 +18,8 @@ import {TRIGGER_STEP_ID,WORKFLOW_TRIGGER_METADATA_KEY,WORKFLOW_TRIGGER_PAYLOAD_KEY,- WORKFLOW_TRIGGER_PAYLOAD_LABEL,+ WORKFLOW_TRIGGER_RECORD_LABEL,+ WORKFLOW_TRIGGER_RECORDS_LABEL,WorkflowActionType,} from 'twenty-shared/workflow';@@ -480,7 +481,7 @@ export class WorkflowSchemaWorkspaceService {const payload: Node = {isLeaf: false,type: 'object',- label: WORKFLOW_TRIGGER_PAYLOAD_LABEL,+ label: WORKFLOW_TRIGGER_RECORD_LABEL,value: recordOutputSchema,};@@ -500,7 +501,7 @@ export class WorkflowSchemaWorkspaceService {const payload: Node = {isLeaf: false,type: 'object',- label: WORKFLOW_TRIGGER_PAYLOAD_LABEL,+ label: WORKFLOW_TRIGGER_RECORDS_LABEL,value: {[objectMetadataInfo.flatObjectMetadata.namePlural]: {label: objectMetadataInfo.flatObjectMetadata.labelPlural,diff --git a/packages/twenty-shared/src/workflow/constants/WorkflowTriggerPayloadLabel.ts b/packages/twenty-shared/src/workflow/constants/WorkflowTriggerPayloadLabel.tsdeleted file mode 100644index 7a3b30e0401..00000000000--- a/packages/twenty-shared/src/workflow/constants/WorkflowTriggerPayloadLabel.ts+++ /dev/null@@ -1 +0,0 @@-export const WORKFLOW_TRIGGER_PAYLOAD_LABEL = 'Payload';diff --git a/packages/twenty-shared/src/workflow/constants/WorkflowTriggerRecordLabel.ts b/packages/twenty-shared/src/workflow/constants/WorkflowTriggerRecordLabel.tsnew file mode 100644index 00000000000..cba335ea2ce--- /dev/null+++ b/packages/twenty-shared/src/workflow/constants/WorkflowTriggerRecordLabel.ts@@ -0,0 +1 @@+export const WORKFLOW_TRIGGER_RECORD_LABEL = 'Record';diff --git a/packages/twenty-shared/src/workflow/constants/WorkflowTriggerRecordsLabel.ts b/packages/twenty-shared/src/workflow/constants/WorkflowTriggerRecordsLabel.tsnew file mode 100644index 00000000000..0019511acdd--- /dev/null+++ b/packages/twenty-shared/src/workflow/constants/WorkflowTriggerRecordsLabel.ts@@ -0,0 +1 @@+export const WORKFLOW_TRIGGER_RECORDS_LABEL = 'Records';diff --git a/packages/twenty-shared/src/workflow/index.ts b/packages/twenty-shared/src/workflow/index.tsindex c905a253795..a61d70d8e9b 100644--- a/packages/twenty-shared/src/workflow/index.ts+++ b/packages/twenty-shared/src/workflow/index.ts@@ -17,7 +17,8 @@ export { WORKFLOW_TRIGGER_METADATA_LABEL } from './constants/WorkflowTriggerMetaexport { WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_KEY } from './constants/WorkflowTriggerMetadataWorkspaceMemberIdKey';export { WORKFLOW_TRIGGER_METADATA_WORKSPACE_MEMBER_ID_LABEL } from './constants/WorkflowTriggerMetadataWorkspaceMemberIdLabel';export { WORKFLOW_TRIGGER_PAYLOAD_KEY } from './constants/WorkflowTriggerPayloadKey';-export { WORKFLOW_TRIGGER_PAYLOAD_LABEL } from './constants/WorkflowTriggerPayloadLabel';+export { WORKFLOW_TRIGGER_RECORD_LABEL } from './constants/WorkflowTriggerRecordLabel';+export { WORKFLOW_TRIGGER_RECORDS_LABEL } from './constants/WorkflowTriggerRecordsLabel';export { WORKFLOW_DIAGRAM_DEFAULT_NODE_DIMENSIONS } from './layout/constants/WorkflowDiagramDefaultNodeDimensions';export { WORKFLOW_LAYOUT_DEFAULT_OPTIONS } from './layout/constants/WorkflowLayoutDefaultOptions';export type {