← back to Sample Followup Sweep
sample-followup: on real send, auto-stamp 2nd-request date (Date Sample Request Letter Sent) in all 3 send paths (fmpro console send, scheduled --send, sent-poller) — Steve 8/25
32145b7bbbfb316b4c5bd36cfb321122a3d93039 · 2026-08-25 10:14:42 -0700 · Steve Abrams
Files touched
M scripts/fmpro.mjsM scripts/scheduled-run.mjsM scripts/watch-sent-stamp.mjs
Diff
commit 32145b7bbbfb316b4c5bd36cfb321122a3d93039
Author: Steve Abrams <steve@designerwallcoverings.com>
Date: Tue Aug 25 10:14:42 2026 -0700
sample-followup: on real send, auto-stamp 2nd-request date (Date Sample Request Letter Sent) in all 3 send paths (fmpro console send, scheduled --send, sent-poller) — Steve 8/25
---
scripts/fmpro.mjs | 5 ++++-
scripts/scheduled-run.mjs | 5 ++++-
scripts/watch-sent-stamp.mjs | 10 ++++++----
3 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/scripts/fmpro.mjs b/scripts/fmpro.mjs
index 833fc60..4ab60d3 100644
--- a/scripts/fmpro.mjs
+++ b/scripts/fmpro.mjs
@@ -30,6 +30,9 @@ const ROOT = join(__dir, '..');
const DB = 'WALLPAPER';
const LAYOUT = 'Report for old memo samples'; // exposes vid, combo sku, today for client, Date WP Sample Sent
const FIELD_SENT = 'Date Email Sent to Vendor after 10 Days';
+// Steve 8/25: on a real send, ALSO stamp the 2nd-request date. No dedicated "2nd request date"
+// field is exposed to the Data API; this real date field on the same layout is the chosen target.
+const FIELD_2ND_DATE = 'Date Sample Request Letter Sent';
const FIELD_NOTES = 'Priority Memo Notes';
const MIN_AGE_DAYS = 10; // don't chase newer than 10 days
const MAX_AGE_DAYS = 60; // >60 = dead lead, don't chase (Steve's rule)
@@ -110,7 +113,7 @@ async function stampVendor(v) {
const rows = await planVendor(v);
const stamped = [];
for (const r of rows) {
- const res = await fm.updateRecord(DB, LAYOUT, r.recordId, { [FIELD_SENT]: r.date }, { dryRun: false });
+ const res = await fm.updateRecord(DB, LAYOUT, r.recordId, { [FIELD_SENT]: r.date, [FIELD_2ND_DATE]: r.date }, { dryRun: false });
if (res.committed) stamped.push(r);
}
return { vid: v.vid, date: v.date, count: stamped.length, found: rows.length, stamped };
diff --git a/scripts/scheduled-run.mjs b/scripts/scheduled-run.mjs
index bbdbfea..4d4d1c3 100644
--- a/scripts/scheduled-run.mjs
+++ b/scripts/scheduled-run.mjs
@@ -35,6 +35,9 @@ const DRAFT = process.argv.includes('--draft');
const DB = 'WALLPAPER';
const LAYOUT = 'Report for old memo samples';
const FIELD_SENT = 'Date Email Sent to Vendor after 10 Days';
+// Steve 8/25: on a real send, ALSO stamp the 2nd-request date (chosen target — no dedicated
+// "2nd request date" field is exposed to the Data API; this real date field is on the same layout).
+const FIELD_2ND_DATE = 'Date Sample Request Letter Sent';
// Steve 8/20 (REVISED): chase ONLY memos that JUST crossed the 10-day mark — a rolling 3-day
// catch-up band, NOT the whole back-catalog. "10 days old exactly, for the past 3 days" → on 8/20
// that is entered dates 8/8, 8/9, 8/10. The open-ended `...hi` was pulling every old memo; this
@@ -206,7 +209,7 @@ const run = async () => {
if (!SEND) { sent.push({ vid, name: c.name, to: draft.to, n: rows.length, skus: rows.map((r) => r.sku), dryRun: true }); continue; }
const res = await georgeSend({ account: 'info', to: draft.to, subject: draft.subject, body: draft.html });
if (res.ok) {
- for (const r of rows) { try { await fm.updateRecord(DB, LAYOUT, r.recordId, { [FIELD_SENT]: today }, { dryRun: false }); } catch {} }
+ for (const r of rows) { try { await fm.updateRecord(DB, LAYOUT, r.recordId, { [FIELD_SENT]: today, [FIELD_2ND_DATE]: today }, { dryRun: false }); } catch {} }
sent.push({ vid, name: c.name, to: draft.to, n: rows.length, messageId: res.id });
} else {
skipped.push({ vid, n: rows.length, reason: 'George send failed: ' + res.detail });
diff --git a/scripts/watch-sent-stamp.mjs b/scripts/watch-sent-stamp.mjs
index b9b92f6..d9b9366 100644
--- a/scripts/watch-sent-stamp.mjs
+++ b/scripts/watch-sent-stamp.mjs
@@ -9,7 +9,9 @@ const ROOT = join(homedir(), 'Projects/sample-followup-sweep');
const LEDGER = join(ROOT, 'data/stamp-ledger.json');
const DB = 'WALLPAPER', LAYOUT = 'Report for old memo samples';
const FIELD_SENT = 'Date Email Sent to Vendor after 10 Days';
-const FIELD_2ND = '2nd Request';
+// Steve 8/25: stamp the 2nd-request DATE on a real send. No dedicated "2nd request date" field is
+// exposed to the Data API (only text "Dear Vendor 2nd Request"); this real date field is the chosen target.
+const FIELD_2ND_DATE = 'Date Sample Request Letter Sent';
const WIN = process.env.WIN || '08/06/2026...08/10/2026';
const POLL_SECS = Number(process.env.POLL_SECS || 45);
@@ -42,9 +44,9 @@ async function stampVids(vids) {
for (const vid of vids) {
const rows = (await fm.findRecords(DB, 'REPORT ON SAMPLES ORDERED', { 'Date WP Sample Sent': '=', vid, 'today for client': WIN }, { limit: 200 }).catch(() => ({ records: [] }))).records;
for (const r of rows) {
- // Steve 8/20: the "2nd Request" marker IS the API-writable "Date Email Sent to Vendor after
- // 10 Days" field (the true 2nd Request date field isn't on any Data-API layout).
- await fm.updateRecord(DB, LAYOUT, r.recordId, { [FIELD_SENT]: today }, { dryRun: false }).catch(() => {});
+ // Steve 8/25: on a real send stamp BOTH the dedup guard (Date Email Sent…) AND the
+ // 2nd-request date (Date Sample Request Letter Sent — the chosen API-reachable date field).
+ await fm.updateRecord(DB, LAYOUT, r.recordId, { [FIELD_SENT]: today, [FIELD_2ND_DATE]: today }, { dryRun: false }).catch(() => {});
n++;
}
}
← 93219aa auto-data-snapshot: 2026-08-25T10:08:44 (4 data files) — dat
·
back to Sample Followup Sweep
·
sample-followup: correct Elitis contact to US rep ANNALISA@e 29048f5 →