diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
index 706c196fff..4400c3fcf3 100644
--- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
+++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte
@@ -186,6 +186,12 @@
{:else if isDisabled}
+ {:else if action.new}
+
+
+ New
+
+
{/if}
diff --git a/packages/server/src/automations/steps/executeScript.ts b/packages/server/src/automations/steps/executeScript.ts
index 97145f3e14..58ddb332c1 100644
--- a/packages/server/src/automations/steps/executeScript.ts
+++ b/packages/server/src/automations/steps/executeScript.ts
@@ -15,6 +15,7 @@ import { EventEmitter } from "events"
export const definition: AutomationStepDefinition = {
name: "JS Scripting",
+ deprecated: true,
tagline: "Execute JavaScript Code",
icon: "Code",
description: "Run a piece of JavaScript code in your automation",
diff --git a/packages/server/src/automations/steps/executeScriptV2.ts b/packages/server/src/automations/steps/executeScriptV2.ts
index d568245f4d..f5edf20f7d 100644
--- a/packages/server/src/automations/steps/executeScriptV2.ts
+++ b/packages/server/src/automations/steps/executeScriptV2.ts
@@ -12,12 +12,13 @@ import {
import { processStringSync } from "@budibase/string-templates"
export const definition: AutomationStepDefinition = {
- name: "JS Scripting V2",
+ name: "JS Scripting",
tagline: "Execute JavaScript Code",
icon: "Code",
description: "Run a piece of JavaScript code in your automation",
type: AutomationStepType.ACTION,
internal: true,
+ new: true,
stepId: AutomationActionStepId.EXECUTE_SCRIPT_V2,
inputs: {},
features: {
@@ -57,7 +58,9 @@ export async function run({
inputs: ExecuteScriptStepInputs
context: Record
}): Promise {
- if (inputs.code == null) {
+ let { code } = inputs
+
+ if (code == null) {
return {
success: false,
response: {
@@ -66,6 +69,17 @@ export async function run({
}
}
+ code = code.trim()
+
+ if (!code.startsWith("{{ js ")) {
+ return {
+ success: false,
+ response: {
+ message: "Expected code to be a {{ js }} template block",
+ },
+ }
+ }
+
try {
return {
success: true,
diff --git a/packages/types/src/documents/app/automation/schema.ts b/packages/types/src/documents/app/automation/schema.ts
index 677d25d4ce..a712b9e45b 100644
--- a/packages/types/src/documents/app/automation/schema.ts
+++ b/packages/types/src/documents/app/automation/schema.ts
@@ -154,6 +154,7 @@ export interface AutomationStepSchemaBase {
type: AutomationStepType
internal?: boolean
deprecated?: boolean
+ new?: boolean
blockToLoop?: string
schema: {
inputs: InputOutputBlock