Appearance
An N-days-before reminder job
When you need this
"Remind me N days before <date>." Warranty expiring in 30 days, an audit due in 7, a checkout due back in 3. Zero Java — one entity_status_date_sweep_config row with day_offset set, shipped as seed data.
The file
metadata/seed-data/office-equipment-sweep-configs.json (real file):
json
{
"entity": "entity_status_date_sweep_config",
"keyFields": ["entity_name", "date_field", "set_status_to", "day_offset"],
"source": "office-equipment",
"rows": [
{
"entity_name": "oeq_checkout",
"status_field": "status",
"when_status_in": "CHECKED_OUT",
"date_field": "due_date",
"compare_op": "lte",
"day_offset": 3,
"set_status_to": "DUE_SOON",
"active": true,
"seeded_by": "office-equipment"
}
]
}How to read it
compare_op: "lte" + day_offset: 3 → the job fires for a CHECKED_OUT checkout whose due_date is on or before now + 3 days — i.e. "within 3 days of due". day_offset: 30 = "within 30 days". day_offset: 0 (the default) = "the date has already passed".
Use a distinct target status per window if you want 30/14/7-day reminders that are independently queryable — e.g. DUE_IN_30, DUE_IN_14, DUE_SOON.
The rules that bite
- Flip a status value, not a boolean flag. The generic job passes
set_status_toas a string; writing"true"to a boolean column fails. - Include
day_offsetinkeyFieldsso a 30-day and a 7-day rule for the same date column are distinct on re-install. - Also ship
metadata/entities/entity_status_date_sweep_config.json(additive fields only). The job auto-registers on the first seeded row via a platform-shipped rule — you don't ship a register rule for this job.
Verified
bash
$ erp api post "/api/v1/jobs/engine-entity.status-date-sweep/execute" --body "{}"
{ "executionId": 534 }
$ erp api get "/api/v1/entities/oeq_checkout/records/2"
{ "checkout_number": "CO-100", "status": "OVERDUE" } # was CHECKED_OUT, due_date in the pastRelated
- Add a scheduled reminder job
- Tutorial chapter 7: the return-due reminder job