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:
@@ -41,6 +41,8 @@ export { workflowSendEmailActionSchema } from './schemas/send-email-action-schem
|
||||
export { workflowSendEmailActionSettingsSchema } from './schemas/send-email-action-settings-schema';
|
||||
export { workflowUpdateRecordActionSchema } from './schemas/update-record-action-schema';
|
||||
export { workflowUpdateRecordActionSettingsSchema } from './schemas/update-record-action-settings-schema';
|
||||
export { workflowUpsertRecordActionSchema } from './schemas/upsert-record-action-schema';
|
||||
export { workflowUpsertRecordActionSettingsSchema } from './schemas/upsert-record-action-settings-schema';
|
||||
export { workflowWebhookTriggerSchema } from './schemas/webhook-trigger-schema';
|
||||
export { workflowActionSchema } from './schemas/workflow-action-schema';
|
||||
export { workflowDelayActionSchema } from './schemas/workflow-delay-action-schema';
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
import { z } from 'zod';
|
||||
import { baseWorkflowActionSchema } from './base-workflow-action-schema';
|
||||
import { workflowUpsertRecordActionSettingsSchema } from './upsert-record-action-settings-schema';
|
||||
|
||||
export const workflowUpsertRecordActionSchema = baseWorkflowActionSchema.extend(
|
||||
{
|
||||
type: z.literal('UPSERT_RECORD'),
|
||||
settings: workflowUpsertRecordActionSettingsSchema,
|
||||
},
|
||||
);
|
||||
@@ -0,0 +1,12 @@
|
||||
import { z } from 'zod';
|
||||
import { baseWorkflowActionSettingsSchema } from './base-workflow-action-settings-schema';
|
||||
import { objectRecordSchema } from './object-record-schema';
|
||||
|
||||
export const workflowUpsertRecordActionSettingsSchema =
|
||||
baseWorkflowActionSettingsSchema.extend({
|
||||
input: z.object({
|
||||
objectName: z.string(),
|
||||
objectRecord: objectRecordSchema,
|
||||
fieldsToUpdate: z.array(z.string()),
|
||||
}),
|
||||
});
|
||||
@@ -11,6 +11,7 @@ import { workflowHttpRequestActionSchema } from './http-request-action-schema';
|
||||
import { workflowIteratorActionSchema } from './iterator-action-schema';
|
||||
import { workflowSendEmailActionSchema } from './send-email-action-schema';
|
||||
import { workflowUpdateRecordActionSchema } from './update-record-action-schema';
|
||||
import { workflowUpsertRecordActionSchema } from './upsert-record-action-schema';
|
||||
import { workflowDelayActionSchema } from './workflow-delay-action-schema';
|
||||
|
||||
export const workflowActionSchema = z.discriminatedUnion('type', [
|
||||
@@ -19,6 +20,7 @@ export const workflowActionSchema = z.discriminatedUnion('type', [
|
||||
workflowCreateRecordActionSchema,
|
||||
workflowUpdateRecordActionSchema,
|
||||
workflowDeleteRecordActionSchema,
|
||||
workflowUpsertRecordActionSchema,
|
||||
workflowFindRecordsActionSchema,
|
||||
workflowFormActionSchema,
|
||||
workflowHttpRequestActionSchema,
|
||||
|
||||
Reference in New Issue
Block a user