From 58fedd10f540d1a3c2700e8a83a9eb95ff25155e Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 26 Jan 2024 09:21:13 +0000 Subject: [PATCH] fix issue with automation not triggering when no fields existed --- packages/client/src/utils/buttonActions.js | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index 9b4640dbb4..12fc66270a 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -160,29 +160,27 @@ const deleteRowHandler = async action => { const triggerAutomationHandler = async action => { const { fields, notificationOverride, timeout } = action.parameters - if (fields) { - try { - const result = await API.triggerAutomation({ - automationId: action.parameters.automationId, - fields, - timeout, - }) - - // Value will exist if automation is synchronous, so return it. - if (result.value) { - if (!notificationOverride) { - notificationStore.actions.success("Automation ran successfully") - } - return { result } - } + try { + const result = await API.triggerAutomation({ + automationId: action.parameters.automationId, + fields, + timeout, + }) + // Value will exist if automation is synchronous, so return it. + if (result.value) { if (!notificationOverride) { - notificationStore.actions.success("Automation triggered") + notificationStore.actions.success("Automation ran successfully") } - } catch (error) { - // Abort next actions - return false + return { result } } + + if (!notificationOverride) { + notificationStore.actions.success("Automation triggered") + } + } catch (error) { + // Abort next actions + return false } } const navigationHandler = action => {