Scheduling Reports
This guide explains how to schedule automatic report generation using Business Central's Job Queue integration with Advanced Spreadsheets and Reporting.
Overview
Scheduling allows you to:
- Automatically generate reports on a schedule
- Eliminate manual report generation
- Ensure consistent, timely delivery
How Scheduling Works
Job Queue Entry
↓
Triggers at scheduled time
↓
Runs codeunit "AFR Print Jobs Hgd"
↓
Processes the print jobs matching the Parameter String
↓
Delivers reports (Email/SharePoint)
Jobs with Output = Zip produce nothing when run from the Job Queue; the zip can only be downloaded in an interactive run.
Creating a Schedule
Method 1: From Print Jobs Page
- Open Advanced Spreadsheets and Reporting Print Jobs
- Select the jobs you want to schedule (Ctrl/Shift-click)
- Click Add Job Queue
- Confirm the action
- A Job Queue Entry is created with Status On Hold and the selected Run IDs in its Parameter String; the message "Job Queue Entry created!" is shown. If the Run IDs do not fit the 250-character Parameter String, an error is shown instead.
- Open Job Queue Entries to set the schedule and set Status to Ready
Method 2: Manual Job Queue Setup
- Search for Job Queue Entries
- Click New
- Configure:
- Object Type: Codeunit
- Object ID: 70310707 (AFR Print Jobs Hgd)
- Parameter String: Filter for Run ID(s)
Job Queue Configuration
Basic Settings
| Field | Value |
|---|---|
| Object Type to Run | Codeunit |
| Object ID to Run | 70310707 |
| Description | Your description |
| Parameter String | Print job filter |
Parameter String
The Parameter String filters which print jobs to run:
- Single job:
MONTHLY-PL
| - Multiple jobs: `MONTHLY-PL | MONTHLY-BS` |
|---|
- Pattern:
MONTHLY* - Blank: All jobs
Schedule Settings
| Field | Purpose |
|---|---|
| Starting Time | When to start first run |
| Ending Time | When to stop running |
| Recurring Job | Enable for repeated runs |
| Run on Mondays | Enable for Monday runs |
| Run on Tuesdays | Enable for Tuesday runs |
| ... | (other days) |
| Next Run Date Formula | Formula for next run calculation |
| No. of Minutes between Runs | For intraday scheduling |
Common Schedule Examples
Daily Reports (Weekdays)
Starting Time: 06:00:00
Recurring Job: Yes
Run on Mondays: Yes
Run on Tuesdays: Yes
Run on Wednesdays: Yes
Run on Thursdays: Yes
Run on Fridays: Yes
Run on Saturdays: No
Run on Sundays: No
Weekly Reports (Monday)
Starting Time: 08:00:00
Recurring Job: Yes
Run on Mondays: Yes
All other days: No
Monthly Reports (1st of Month)
Starting Time: 07:00:00
Recurring Job: Yes
Next Run Date Formula: <1M>
Run on all days: Yes (any day, controlled by formula)
First Monday of Month
This requires combining settings:
Starting Time: 07:00:00
Recurring Job: Yes
Run on Mondays: Yes
Next Run Date Formula: <1M>
Then manually adjust the Starting Date to the first Monday.
Step-by-Step: Schedule Monthly Report
Step 1: Create Print Job
First, ensure your print job is configured:
- Open Advanced Spreadsheets and Reporting Print Jobs
- Create job: "Monthly-PL"
- Configure report, dates, output
Step 2: Create Job Queue Entry
- From Print Jobs, click Add Job Queue
- Or create manually in Job Queue Entries
Step 3: Configure Schedule
- Find the new Job Queue Entry
- Set Starting Date and Time
- Enable Recurring Job
- Set run days or formula
Step 4: Set to Ready
- Change Status to Ready
- The job will run at the next scheduled time
Step 5: Monitor
- Check Job Queue Log Entries
- Verify reports are delivered
- Review any errors
Managing Scheduled Jobs
Viewing Job Queue Entries
- Search for Job Queue Entries
- Filter by Object ID to Run = 70310707 for print job entries
- View status and schedule
Pausing a Schedule
- Find the Job Queue Entry
- Set Status to On Hold
- Job won't run until status changes to Ready
Resuming a Schedule
- Find the Job Queue Entry
- Set Status to Ready
- Job resumes on next scheduled time
Deleting a Schedule
- Find the Job Queue Entry
- Delete the entry
- Job no longer runs
Error Handling
Viewing Errors
- Go to Job Queue Log Entries
- Filter for error status
- Review error messages
Common Errors
| Error | Cause | Solution |
|---|---|---|
| No output, log shows success | Parameter String matches no Run ID (job renamed or deleted) | Update the Parameter String; a non-matching filter completes silently |
| Job skipped | The job's financial report no longer exists | Fix the Financial Report on the print job |
| Permission denied | Missing permissions | Check user permissions |
| Email not received, log shows success | Email failures are only reported as a message, which a scheduled run cannot show | Check Email Outbox and Sent Emails |
| Report error | Financial report issue | Check report configuration |
Automatic Retries
Job Queue can retry failed jobs:
- Set Maximum No. of Attempts
- Set Rerun Delay
- Jobs retry automatically
Best Practices
Scheduling
- Off-Peak Hours: Schedule for early morning or evening
- Stagger Jobs: Don't schedule all jobs at same time
- Allow Time: Allow enough time between jobs
Monitoring
- Regular Checks: Review Job Queue Log periodically
- Alert Setup: Configure notifications for failures
- Test Changes: Test configuration changes manually first
Maintenance
- Clean Up: Remove unused Job Queue Entries
- Archive Logs: Periodically archive old log entries
- Document: Maintain list of scheduled jobs
Multiple Jobs in One Schedule
Option 1: Single Entry, Multiple Print Jobs
Use filter in Parameter String:
Parameter String: MONTHLY*
(runs all jobs starting with MONTHLY)
Option 2: Separate Entries
Create individual Job Queue Entries:
- More control per job
- Different schedules possible
- Easier troubleshooting
Recommendation
For different schedules, use separate entries. For same schedule, use filter.
Testing Schedules
Manual Trigger
- Find the Job Queue Entry
- Click Run once
- Entry runs immediately
- Check output and logs
Verify Settings
Before enabling:
- Review all schedule settings
- Confirm Parameter String
- Test with Manual Run All in Print Jobs (Manual Run Single only downloads the file)
Advanced Configurations
Conditional Scheduling
Use date formulas for conditional runs:
Next Run Date Formula: <1M>
(adjusts based on current date)
Multiple Time Zones
If serving multiple time zones:
- Create separate print jobs per region
- Schedule appropriate times for each
Holiday Handling
Job Queue doesn't have built-in holiday support:
- Manually pause jobs during holidays
- Or let them run (empty results are harmless)
Troubleshooting
Job Not Running
- Verify Status = Ready
- Check Starting Date/Time is in the past or present
- Verify run days are enabled
- Check Job Queue is enabled in tenant
Wrong Reports Generated
- Review Parameter String filter
- Check print job configurations
- Verify date formulas
Missing Output
- Check email/SharePoint configuration
- Review Job Queue Log for errors, and Email Outbox / Sent Emails for email failures
- Confirm the Parameter String matches at least one Run ID
- Remember that Zip output is discarded in scheduled runs
- Test print job manually