JavaScript · Track 7 · Tutorial 2 of 5

Check it ran

The morning after, check that last night's run recalculated your month and took your consolidation request - before anyone reads the reports.

You will needA month and a consolidation request from the earlier tutorials, and a night since.
By the endA script that tells you, each morning, whether the figures are ready.

1What to check, the morning after

Two things say whether last night's run took your work: the month's request - is it recalculated? - and the consolidation request - did the run take it?

The two things to check, and what each can say
What to read the morning after: the month's recalculation, and the consolidation request's status.

2Write the check

Create check-run.mjs. It takes the two IDs your scripts printed:

check-run.mjs

// check-run.mjs - checks, the morning after, whether last night's run took your work.
//   node check-run.mjs <trial balance request id> <consolidation request id>
import { call, companyId } from './brizo.mjs';

const [monthRequest, consolidationRequest] = process.argv.slice(2);
if (consolidationRequest === undefined) {
    console.log('Usage: node check-run.mjs <trial balance request id> <consolidation request id>');
    process.exit(1);
}

const month = (await call('GET', `/organisations/${companyId}/requests/${monthRequest}`)).body;
console.log(`Trial balance request ${monthRequest}: recalculation ${month.recalculation}`);
if (month.recalculation === 'failed') {
    console.log(`  failed at ${month.recalculation_step}`);
}

const run = (await call('GET', `/organisations/${companyId}/consolidation-requests/${consolidationRequest}`)).body.data;
console.log(`Consolidation request ${consolidationRequest}: ${run.status}`
    + (run.dispatched_at !== null ? ` at ${run.dispatched_at}` : ''));

3Run it

node check-run.mjs 91 12

Check

Trial balance request 91: recalculation done
Consolidation request 12: dispatched at 2026-10-03T01:40:03+08:00

Use your own IDs. done means the month is in the reports.

dispatched means started; done means finished
Dispatched means the run started the work; done means your month is in the reports.

4If something failed

  • A month's recalculation of failed names the step it failed at. Send the month again with a new key to try again.
  • A consolidation request of failed isn't tried again. Ask for a new one.
  • Still pending in the morning means the run hasn't taken it yet.

Want more detail? See the documentation