Advanced Spreadsheets and Reporting Documentation
Index

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

  1. Open Advanced Spreadsheets and Reporting Print Jobs
  2. Select the jobs you want to schedule (Ctrl/Shift-click)
  3. Click Add Job Queue
  4. Confirm the action
  5. 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.
  6. Open Job Queue Entries to set the schedule and set Status to Ready

Method 2: Manual Job Queue Setup

  1. Search for Job Queue Entries
  2. Click New
  3. 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:

  1. Open Advanced Spreadsheets and Reporting Print Jobs
  2. Create job: "Monthly-PL"
  3. Configure report, dates, output

Step 2: Create Job Queue Entry

  1. From Print Jobs, click Add Job Queue
  2. Or create manually in Job Queue Entries

Step 3: Configure Schedule

  1. Find the new Job Queue Entry
  2. Set Starting Date and Time
  3. Enable Recurring Job
  4. Set run days or formula

Step 4: Set to Ready

  1. Change Status to Ready
  2. The job will run at the next scheduled time

Step 5: Monitor

  1. Check Job Queue Log Entries
  2. Verify reports are delivered
  3. Review any errors

Managing Scheduled Jobs

Viewing Job Queue Entries

  1. Search for Job Queue Entries
  2. Filter by Object ID to Run = 70310707 for print job entries
  3. View status and schedule

Pausing a Schedule

  1. Find the Job Queue Entry
  2. Set Status to On Hold
  3. Job won't run until status changes to Ready

Resuming a Schedule

  1. Find the Job Queue Entry
  2. Set Status to Ready
  3. Job resumes on next scheduled time

Deleting a Schedule

  1. Find the Job Queue Entry
  2. Delete the entry
  3. Job no longer runs

Error Handling

Viewing Errors

  1. Go to Job Queue Log Entries
  2. Filter for error status
  3. 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:

  1. Set Maximum No. of Attempts
  2. Set Rerun Delay
  3. Jobs retry automatically

Best Practices

Scheduling

  1. Off-Peak Hours: Schedule for early morning or evening
  2. Stagger Jobs: Don't schedule all jobs at same time
  3. Allow Time: Allow enough time between jobs

Monitoring

  1. Regular Checks: Review Job Queue Log periodically
  2. Alert Setup: Configure notifications for failures
  3. Test Changes: Test configuration changes manually first

Maintenance

  1. Clean Up: Remove unused Job Queue Entries
  2. Archive Logs: Periodically archive old log entries
  3. 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

  1. Find the Job Queue Entry
  2. Click Run once
  3. Entry runs immediately
  4. Check output and logs

Verify Settings

Before enabling:

  1. Review all schedule settings
  2. Confirm Parameter String
  3. 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

  1. Verify Status = Ready
  2. Check Starting Date/Time is in the past or present
  3. Verify run days are enabled
  4. Check Job Queue is enabled in tenant

Wrong Reports Generated

  1. Review Parameter String filter
  2. Check print job configurations
  3. Verify date formulas

Missing Output

  1. Check email/SharePoint configuration
  2. Review Job Queue Log for errors, and Email Outbox / Sent Emails for email failures
  3. Confirm the Parameter String matches at least one Run ID
  4. Remember that Zip output is discarded in scheduled runs
  5. Test print job manually