Skip to content
// One lead's record (for checking the flow and debugging).
const q = $('Lead Status API').first().json.query ?? {};
const db = $getWorkflowStaticData('global');
const lead = (db.leads ?? {})[String(q.lead_id ?? '')] ?? Object.values(db.leads ?? {}).find((l) => l.email === String(q.email ?? '').toLowerCase());
return [{ json: lead ? { found: true, ...lead, holds: Object.entries(db.holds ?? {}).filter(([, h]) => h.lead_id === lead.id).map(([k]) => k) } : { found: false } }];