feat: add create or update workflow trigger (#14708)

### Description

This PR focuses on
https://github.com/twentyhq/core-team-issues/issues/1476

- introduces the handling of upserted events in the workflow trigger
system


## Visual Appearance
<img width="1792" height="1039" alt="Screenshot 2025-09-21 at 11 40
28 PM"
src="https://github.com/user-attachments/assets/d926b566-f7d3-412b-b1ab-ed2064425f3d"
/>

<img width="501" height="1025" alt="Screenshot 2025-09-21 at 11 40
39 PM"
src="https://github.com/user-attachments/assets/13c3031a-0762-4c80-8df1-fa74ca70a540"
/>


### Changes
- Added `UPSERTED` action to the `DatabaseEventAction` enum.
- Updated the `WorkflowEditTriggerDatabaseEventForm` to support upserted
events.

---------

Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
This commit is contained in:
Harshit Singh
2025-10-01 18:47:05 +05:30
committed by GitHub
parent b5e6703f35
commit ae4a93c993
22 changed files with 213 additions and 16 deletions
@@ -82,6 +82,8 @@ export const WorkflowEditTriggerDatabaseEventForm = ({
trigger.settings.eventName,
);
const isUpdateEvent = triggerEvent.event === 'updated';
const isUpsertEvent = triggerEvent.event === 'upserted';
const isFieldFilteringSupported = isUpdateEvent || isUpsertEvent;
const regularObjects = objectMetadataItems
.filter((item) => item.isActive && !item.isSystem)
@@ -271,7 +273,7 @@ export const WorkflowEditTriggerDatabaseEventForm = ({
dropdownOffset={{ y: parseInt(theme.spacing(1), 10) }}
/>
</StyledRecordTypeSelectContainer>
{isDefined(selectedObjectMetadataItem) && isUpdateEvent && (
{isDefined(selectedObjectMetadataItem) && isFieldFilteringSupported && (
<WorkflowFieldsMultiSelect
label="Fields (Optional)"
placeholder="Select specific fields to listen to"
@@ -2,4 +2,5 @@ export enum DatabaseTriggerDefaultLabel {
RECORD_IS_CREATED = 'Record is created',
RECORD_IS_UPDATED = 'Record is updated',
RECORD_IS_DELETED = 'Record is deleted',
RECORD_UPSERTED = 'Record is created or updated',
}
@@ -25,4 +25,10 @@ export const DATABASE_TRIGGER_TYPES: Array<{
icon: 'IconTrash',
event: 'deleted',
},
{
defaultLabel: DatabaseTriggerDefaultLabel.RECORD_UPSERTED,
type: 'DATABASE_EVENT',
icon: 'IconPencilPlus',
event: 'upserted',
},
];