Skip to content

Commit

Permalink
Add createdBy source for workflows (#9342)
Browse files Browse the repository at this point in the history
Fix createdBy that is not displayed for workflows

<img width="1510" alt="Capture d’écran 2025-01-03 à 17 58 05"
src="https://github.com/user-attachments/assets/f2d4d7a9-466b-46e7-9d43-d55de88fb803"
/>
  • Loading branch information
thomtrp authored Jan 3, 2025
1 parent 694c8aa commit 5bd2154
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
IconCsv,
IconGmail,
IconRobot,
IconSettingsAutomation,
} from 'twenty-ui';

type ActorDisplayProps = Partial<FieldActorValue> & {
Expand All @@ -32,6 +33,8 @@ export const ActorDisplay = ({
return IconCalendar;
case 'SYSTEM':
return IconRobot;
case 'WORKFLOW':
return IconSettingsAutomation;
default:
return undefined;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { Repository } from 'typeorm';
import { WorkflowAction } from 'src/modules/workflow/workflow-executor/interfaces/workflow-action.interface';

import { DatabaseEventAction } from 'src/engine/api/graphql/graphql-query-runner/enums/database-event-action';
import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type';
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
import { ScopedWorkspaceContextFactory } from 'src/engine/twenty-orm/factories/scoped-workspace-context.factory';
import { TwentyORMManager } from 'src/engine/twenty-orm/twenty-orm.manager';
Expand Down Expand Up @@ -56,9 +57,13 @@ export class CreateRecordWorkflowAction implements WorkflowAction {
);
}

const objectRecord = await repository.save(
workflowActionInput.objectRecord,
);
const objectRecord = await repository.save({
...workflowActionInput.objectRecord,
createdBy: {
source: FieldActorSource.WORKFLOW,
name: 'Workflow',
},
});

this.workspaceEventEmitter.emitDatabaseBatchEvent({
objectMetadataNameSingular: workflowActionInput.objectName,
Expand Down

0 comments on commit 5bd2154

Please sign in to comment.