Developer ToolsFree generatorPDF, Excel, Word exportInfor SyteLineAll Infor SyteLine (CloudSuite Industrial) tools

SyteLine Background Task History Query Generator for TaskMan

This generator writes read-only SQL for monitoring SyteLine 9/10 on-prem TaskMan: which reports and background tasks failed, how long each task runs, what is stuck in the queue, and which submissions never produced a history record. It reads the same rows as the Background Task History form, but you can schedule it, alert on it and filter it any way you like.

Fill in

For example %Report% or a single task name.

Confirm with block 0. Every column field can be corrected to your schema.

Generated code
Download:

0. Confirm the column names first

SELECT TABLE_NAME, COLUMN_NAME, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME IN (N'BGTaskHistory', N'ActiveBGTasks')
ORDER BY TABLE_NAME, ORDINAL_POSITION;

1. Failed runs in the last N days

SELECT TOP (100)
    h.[TaskNumber],
    h.[TaskName],
    h.[RequestingUser],
    h.[SubmissionDate],
    h.[StartDate],
    h.[CompletionDate],
    h.[ReturnStatus],
    h.[TaskErrorMsg]
FROM dbo.BGTaskHistory h
WHERE h.[CompletionDate] IS NOT NULL
  AND ISNULL(h.[TaskErrorMsg], N'') <> N''
  AND h.[SubmissionDate] >= DATEADD(day, -7, GETDATE())
  AND h.[TaskName] LIKE N'%'
ORDER BY h.[CompletionDate] DESC;

2. Run count, success count and duration per task

SELECT
    h.[TaskName] AS task_name,
    COUNT(*) AS runs,
    SUM(CASE WHEN h.[CompletionDate] IS NOT NULL AND ISNULL(h.[TaskErrorMsg], N'') = N'' THEN 1 ELSE 0 END) AS successful_runs,
    AVG(CAST(DATEDIFF(second, h.[StartDate], h.[CompletionDate]) AS bigint)) AS avg_duration_s,
    MAX(DATEDIFF(second, h.[StartDate], h.[CompletionDate])) AS max_duration_s,
    AVG(CAST(DATEDIFF(second, h.[SubmissionDate], h.[StartDate]) AS bigint)) AS avg_queue_delay_s,
    SUM(CASE WHEN DATEDIFF(second, h.[StartDate], h.[CompletionDate]) >= 600 THEN 1 ELSE 0 END) AS slow_runs
FROM dbo.BGTaskHistory h
WHERE h.[SubmissionDate] >= DATEADD(day, -7, GETDATE())
  AND h.[TaskName] LIKE N'%'
GROUP BY h.[TaskName]
ORDER BY avg_duration_s DESC;

3. Queue entries waiting longer than the threshold

SELECT a.*
FROM dbo.ActiveBGTasks a
WHERE a.[SubmissionDate] < DATEADD(minute, -60, GETDATE())
ORDER BY a.[SubmissionDate];

4. Queue entries with no history record

SELECT a.*
FROM dbo.ActiveBGTasks a
WHERE NOT EXISTS (
    SELECT 1
    FROM dbo.BGTaskHistory h
    WHERE h.[TaskNumber] = a.[TaskNumber]
)
ORDER BY a.[SubmissionDate];

ActiveBGTasks is the TaskMan queue and BGTaskHistory holds the run history shown in the Background Task History form. Column names are defaults to be confirmed with block 0 or sp_help 'BGTaskHistory' on your SyteLine 9/10 database; correct any field that differs. Read-only: never delete queue or history rows by hand, use the Active Background Tasks and Background Task History forms.

Want failed jobs flagged automatically?

Send us your block 2 output and we will suggest thresholds and a daily alert for the tasks that matter in your SyteLine environment.

Optional. The tool and every export work without this. No spam.

Was this tool useful?

How to use it

Run block 0 first on the application database and compare the column list with the column fields. The defaults are the commonly used names, but correct any that differ on your version, and the other blocks update instantly. Then set the days back window and an optional task name pattern. Block 1 lists recent failures with the error text. Block 2 gives one row per task with run count, successful runs, average and maximum duration and average time spent waiting in the queue. Block 3 shows queue rows older than your threshold, which usually means TaskMan is stopped, the service account lost access, or a task is hung. Block 4 finds queue rows that never got a history row.

  • Daily: block 1 for the overnight report and job run
  • Weekly: block 2 to spot tasks getting slower as data grows
  • On a user complaint: blocks 3 and 4

How TaskMan records a run

When a user runs a report or a utility from a SyteLine form in background mode, the form submits a row to ActiveBGTasks. TaskMan, the Windows service on the utility server, polls that queue, runs the task (a report through the report server, a stored procedure, or an executable) and updates the row. The matching record in BGTaskHistory is what the Background Task History form shows. Block 2 treats a run as successful when it has a completion date and a blank error message, and measures duration as the seconds between start and completion; adjust that rule if your tasks report failures only through the return status. For executable tasks the return status holds the program's return code, so a non-zero value is worth reading even when the error text is blank.

    Worked example

    An administrator sets days back to 7 and the filter to %Invoice%. Block 2 returns the invoice print task with 35 runs, 33 successful, an average of 95 seconds and a maximum of 1,480 seconds, with two slow runs above 600 seconds. Block 1 shows the two failures, both with a report server timeout message on Monday morning. Average queue delay of 400 seconds on the same morning suggests TaskMan was busy with month-end jobs. The fix is scheduling, not the report itself: move the heavy jobs out of the morning window or add a second TaskMan instance if your licensing and setup allow it.

      When a report seems to run but nothing appears

      If a user gets a success message but no output and no history record, check block 4 and the queue. A missing history record often means the submission never reached ActiveBGTasks, so the message on the form was misleading; no history can be written for a request that was never queued. If the row is in the queue but never starts, check that the TaskMan service is running on the utility server, its configuration points at the right application database, and its account can reach the report server. If it starts and fails, the error message in block 1 is usually specific.

        Frequently Asked Questions

        How do I run a report in SyteLine?

        Open the report form, set the ranges and options, and choose Preview to view it on screen or Print to send it to TaskMan as a background task. Background runs are recorded in Background Task History, where you can see status, timing and any error message, and reopen the output.

        Where is SyteLine background task history stored?

        In the BGTaskHistory table in the application database. Requests first land in ActiveBGTasks, the TaskMan queue, and each run is recorded in BGTaskHistory. The Background Task History form reads this table, so any row you query can be checked there, including its error message and output.

        Why is my SyteLine report stuck in the queue?

        Usually because TaskMan is not processing: the service is stopped, it points at a different configuration, or an earlier task is hung. Block 3 lists queue rows older than your threshold. Restart TaskMan through your normal change process and check its log before deleting anything.

        Is it safe to query BGTaskHistory directly?

        Read-only queries with a date filter are safe on a well-indexed system, and better run on a reporting copy if the table is large. Do not delete or update history or queue rows by SQL; use the forms and any purge utility Infor provides so related records stay consistent.

        If you want administrators to ask why last night's SyteLine jobs failed and get an answer from this data on your own servers, we can set up a private AI layer for that.

        ArchRay builder
        Design the on-prem AI stack for Infor SyteLine: model, GPUs, RAG pipeline, guardrails
        See memory, speed and cost as you swap parts, then export the diagram. Free, in your browser.
        Open the builder

        Keep exploring

        Free tools

        ERP fixes and how-tos

        Guides