Advanced Spreadsheets and Reporting Documentation
Index

Generating & Scheduling

A report is generated from an instruction: on demand, in the background, or on a recurring job queue schedule. Every run creates a new report for the period the instruction's formulas resolve to on that day.

Ways to Run an Instruction

Action Where How it runs
Generate Instructions list, instruction card In a background session. A message gives the report number and you can keep working. Follow the progress in AI Reports.
Generate and Open Instructions list, instruction card In your session, with a Generating… dialog. When the run ends, the report opens in the viewer. If it failed, a message with the error comes first. Handy while you tune a prompt.
Generate Again AI Reports list In the background, from the selected report's instruction, for the period the instruction resolves to today (not the old report's period).
Generate Unattended AI Report Designer In the background, from the instruction's prompt alone, to test whether it reproduces your design. Requires a prompt.
Schedule Instructions list Creates a recurring job queue entry. See Scheduling.

Anyone with access to the instruction can run it: owners and Read Only users alike. A background run keeps going if you close the page or sign out.

What a Run Does

  1. Resolve the period. The formulas are applied to the work date (see which work date). An invalid formula stops the run before a report is created.
  2. Create the report row, status Queued, with:
    • the period and comparison period,
    • the default title (Description (period)),
    • Generated By = the user who started it,
    • a copy of the instruction's permission list as the report's own list.
  3. Start the agent. Status becomes Generating. The agent gets its instructions:
    • the house style,
    • the company context and periods,
    • the rules for the page (see What You Can Ask For),
    • the instruction's prompt.
  4. Work loop. Each round trip, the model answers and usually asks for tools: look up tables, query data, run financial reports, read spreadsheets, render graphics, write or edit the page. The app runs the tools and returns the results. The loop ends when the model answers without asking for a tool, or when Max. Tool Rounds is reached.
  5. Store the result.
    • Completed: the page was written. The HTML, the title the agent gave it, the agent's closing message (stored as Summary), the number of tool calls and the generation log are saved. Charts and diagrams are inserted into the page at this point.
    • Failed: something went wrong. The Error Message says what. Any page the agent wrote before the failure is kept and shown with a warning banner.
  6. Bookkeeping. The instruction's Last Generated At and Last Status are updated, and old reports are pruned.

The generation log is written when the run ends. While a report is still Generating, its log is empty.

Statuses

Status Colour in the list Meaning
Queued Standard The row exists; the background session has not started the agent yet.
Generating Yellow The agent is working.
Completed Green The report is ready.
Failed Red The run stopped with an error. See Error Message and the troubleshooting page.

Use Refresh on the AI Reports list, or in the viewer, to follow a report in progress. A report that is not ready yet opens as a status page (status, start time, who started it, any error) instead of the report.

Common reasons for Failed:

  • the round-trip limit was reached,
  • the agent ended without writing a page,
  • the AI provider returned an error (key, quota, model name),
  • no provider is set up,
  • outgoing HTTP requests are blocked,
  • the background session could not be started.

How Long It Takes, and What It Costs

A run typically takes one to several minutes. The agent:

  • reads table definitions,
  • queries the report period and the comparison period,
  • cross-checks totals,
  • renders the graphics,
  • writes the page and reviews it once.

It is told how many round trips it has and plans for roughly 10–15 data calls, 3–8 graphics and 2–4 writing calls.

Provider cost depends on the model, the number of round trips and the size of the results. The setup's Max. Tool Rounds and Max. SQL Rows per Query cap both. Prompts that name financial reports or spreadsheets, and ask for aggregated breakdowns rather than long lists, are faster and cheaper.

Several runs can be in progress at the same time; each background run uses its own session.

Scheduling

Schedule on the instructions list creates a job queue entry and opens its card:

Job queue entry field Value set by Schedule
Object Type to Run / Object ID to Run Codeunit 70310732 AI Report Job Queue Hgd
Parameter String The instruction code
Description AI report: \
Recurring Job Yes
Run on Mondays … Fridays Yes (Saturday and Sunday no)
Starting Time 06:00
Status On Hold

Adjust the days, the time or a Next Run Date Formula, then use Set Status to Ready. Nothing runs while the entry is on hold. Each run creates a new report for the period the formulas resolve to on that day.

An instruction can have several job queue entries; the Scheduled Jobs column counts them. You can also create entries by hand with the same object and parameter string.

Example: last month's report on the 2nd of every month

  1. Instruction formulas: Start -1M-CM, Term 1M, Compare -1Y.
  2. Schedule, then on the job queue entry card:
    • set Next Run Date Formula to 1M. This clears the weekday checkboxes; ticking a weekday again clears the formula.
    • set Earliest Start Date/Time to the 2nd of next month, 06:00.
  3. Set Status to Ready.

On 2 November 2026 the run reports on October 2026 against October 2025, on 2 December on November, and so on.

Who runs a scheduled report

A scheduled run executes as the user in the job queue entry's User ID field. Normally that is the user who created it with Schedule. That user:

  • needs access to the instruction (Owner or Read Only). Without it, the run stops with You do not have access to AI report instruction … and the job queue entry goes to Error,
  • needs Business Central read permissions for the data the prompt asks for, and access to any company it names,
  • becomes Generated By on every report the schedule produces, and may therefore delete them.

The report's permission list is a copy of the instruction's list at the time of the run, so the instruction's audience can open each scheduled report.

Failures and the schedule

A failed generation does not fail the job queue entry. It is recorded on the report (Failed, with the error and any partial page) and as the instruction's Last Status, and the schedule keeps running, so one provider hiccup never silences it. The job queue entry itself goes to Error only when the run can never succeed:

  • the parameter string is empty,
  • the instruction no longer exists,
  • the job's user has no access to the instruction.

Deleting an instruction deletes its job queue entries.

Report Retention

Reports to Keep on the instruction (0 = keep all) is applied after every run, including failed runs and reports saved from the designer:

  • Completed and Failed reports of the instruction are counted. When there are more than the limit, the oldest by start time are deleted until the limit is met.
  • The report just produced is never deleted, nor are reports still Queued or Generating.
  • Pruning deletes the report and its permission list regardless of who owns it. It is housekeeping, not a user action.

Set it on scheduled instructions so the list does not grow without bound; for example, 13 on a monthly report keeps a year plus the latest.