From 41051a8d6904c62f7a2c870c5747f5cb4957cfb0 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 15 Jan 2024 10:16:13 +0000 Subject: [PATCH] more naming --- .../automations/steps/triggerAutomationRun.ts | 39 ++++++++++--------- 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/packages/server/src/automations/steps/triggerAutomationRun.ts b/packages/server/src/automations/steps/triggerAutomationRun.ts index d0e0e0a367..829272b847 100644 --- a/packages/server/src/automations/steps/triggerAutomationRun.ts +++ b/packages/server/src/automations/steps/triggerAutomationRun.ts @@ -10,6 +10,7 @@ import { } from "@budibase/types" import * as triggers from "../triggers" import { db as dbCore, context } from "@budibase/backend-core" +import { features } from "@budibase/pro" export const definition: AutomationStepSchema = { name: "Trigger an automation", @@ -62,26 +63,28 @@ export const definition: AutomationStepSchema = { export async function run({ inputs }: AutomationStepInput) { const { automationId, ...fieldParams } = inputs.automation - if (!inputs.automation.automationId) { - return { - success: false, - } - } else { - const db = context.getAppDB() - let automation = await db.get(inputs.automation.automationId) + if (await features.isTriggerAutomationRunEnabled()) { + if (!inputs.automation.automationId) { + return { + success: false, + } + } else { + const db = context.getAppDB() + let automation = await db.get(inputs.automation.automationId) - const response: AutomationResults = await triggers.externalTrigger( - automation, - { - fields: { ...fieldParams }, - timeout: inputs.timeout * 1000 || 120000, - }, - { getResponses: true } - ) + const response: AutomationResults = await triggers.externalTrigger( + automation, + { + fields: { ...fieldParams }, + timeout: inputs.timeout * 1000 || 120000, + }, + { getResponses: true } + ) - return { - success: true, - value: response.steps, + return { + success: true, + value: response.steps, + } } } }