From 2960879fa9fdce87e45d6803d9ce265a9cb062d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=BB=D1=8C=D1=8F=D1=81=20=D0=A1=D1=83=D0=BB=D1=82?= =?UTF-8?q?=D0=B0=D0=BD=D0=BE=D0=B2?= Date: Sun, 6 Sep 2026 13:37:44 +0300 Subject: [PATCH] =?UTF-8?q?Sandbox:=20ctx.tasks.setFieldValue=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BA=D0=B0=D0=BB=20=D0=BD=D0=B5=D1=81=D1=83=D1=89=D0=B5?= =?UTF-8?q?=D1=81=D1=82=D0=B2=D1=83=D1=8E=D1=89=D0=B8=D0=B9=20fieldCode=20?= =?UTF-8?q?+=20=D0=BB=D0=BE=D0=B3=D0=B8=D1=80=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D0=B5=20=D1=82=D1=80=D0=B8=D0=B3=D0=B3=D0=B5=D1=80=D0=BD?= =?UTF-8?q?=D1=8B=D1=85=20=D0=B0=D0=B2=D1=82=D0=BE=D0=BC=D0=B0=D1=82=D0=B8?= =?UTF-8?q?=D0=B7=D0=B0=D1=86=D0=B8=D0=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - automation-worker-code: getFormFields возвращает поле code (не fieldCode) — поиск поля всегда завершался ошибкой 'Field ... not found', ошибка терялась - automation.routes: результаты runAutomationsByTrigger (логи, ошибки) теперь пишутся в консоль сервиса с префиксом [automation] --- server/routes/automation.routes.ts | 6 ++++++ server/workers/automation-worker-code.ts | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/server/routes/automation.routes.ts b/server/routes/automation.routes.ts index a546855..5ed477b 100644 --- a/server/routes/automation.routes.ts +++ b/server/routes/automation.routes.ts @@ -172,6 +172,12 @@ export async function runAutomationsByTrigger( organizationId, triggerData, ); + // Логи выполнения триггерных автоматизаций идут в консоль сервиса (иначе результаты теряются) + if (error) { + console.error(`[automation] ${automation.id} "${automation.name}" — ошибка:`, error, '| логи:', logs); + } else { + console.log(`[automation] ${automation.id} "${automation.name}" — выполнена | логи:`, logs); + } results.push({ automationId: automation.id, name: automation.name, logs, error, result }); } diff --git a/server/workers/automation-worker-code.ts b/server/workers/automation-worker-code.ts index 30c9b0d..abe1768 100644 --- a/server/workers/automation-worker-code.ts +++ b/server/workers/automation-worker-code.ts @@ -95,7 +95,7 @@ const ctx = { const task = await callStorage('getTask', [taskId, organizationId]); if (!task) throw new Error('Task ' + taskId + ' not found'); const formFields = await callStorage('getFormFields', [task.formId, organizationId]); - const field = formFields.find(function(f) { return f.fieldCode === fieldCode; }); + const field = formFields.find(function(f) { return (f.fieldCode || f.code) === fieldCode; }); if (!field) throw new Error('Field ' + fieldCode + ' not found'); const existing = fields.find(function(v) { return v.fieldId === field.id; }); if (existing) {