feat: add-create-update-record in workflow (#14654)
## Description - this PR focuses on issue https://github.com/twentyhq/core-team-issues/issues/1476 - Added upsert action ## Visual Appearance <img width="1792" height="1041" alt="Screenshot 2025-10-03 at 12 57 58 PM" src="https://github.com/user-attachments/assets/57afb96c-d4b3-4a87-95f0-11ac4bd61dd8" /> <img width="1792" height="1031" alt="Screenshot 2025-10-03 at 12 57 48 PM" src="https://github.com/user-attachments/assets/9032d4c2-f0d2-46f1-8682-a7e5c280a303" /> --------- Co-authored-by: Félix Malfait <felix.malfait@gmail.com> Co-authored-by: Thomas Trompette <thomas.trompette@sfr.fr>
This commit is contained in:
+1
@@ -84,6 +84,7 @@ export class WorkflowSchemaWorkspaceService {
|
||||
case WorkflowActionType.CREATE_RECORD:
|
||||
case WorkflowActionType.UPDATE_RECORD:
|
||||
case WorkflowActionType.DELETE_RECORD:
|
||||
case WorkflowActionType.UPSERT_RECORD:
|
||||
return this.computeRecordOutputSchema({
|
||||
objectType: step.settings.input.objectName,
|
||||
workspaceId,
|
||||
|
||||
+22
@@ -245,6 +245,28 @@ export class WorkflowVersionStepOperationsWorkspaceService {
|
||||
},
|
||||
};
|
||||
}
|
||||
case WorkflowActionType.UPSERT_RECORD: {
|
||||
const activeObjectMetadataItem =
|
||||
await this.objectMetadataRepository.findOne({
|
||||
where: { workspaceId, isActive: true, isSystem: false },
|
||||
});
|
||||
|
||||
return {
|
||||
builtStep: {
|
||||
...baseStep,
|
||||
name: 'Create or Update Record',
|
||||
type: WorkflowActionType.UPSERT_RECORD,
|
||||
settings: {
|
||||
...BASE_STEP_DEFINITION,
|
||||
input: {
|
||||
objectName: activeObjectMetadataItem?.nameSingular || '',
|
||||
objectRecord: {},
|
||||
fieldsToUpdate: [],
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
}
|
||||
case WorkflowActionType.FIND_RECORDS: {
|
||||
const activeObjectMetadataItem =
|
||||
await this.objectMetadataRepository.findOne({
|
||||
|
||||
Reference in New Issue
Block a user