Sandbox: ctx.tasks.setFieldValue искал несуществующий fieldCode + логирование триггерных автоматизаций
- automation-worker-code: getFormFields возвращает поле code (не fieldCode) — поиск поля всегда завершался ошибкой 'Field ... not found', ошибка терялась - automation.routes: результаты runAutomationsByTrigger (логи, ошибки) теперь пишутся в консоль сервиса с префиксом [automation]
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user