Erik's ToolBox Documentation
Index

Overview

Erik's ToolBox includes a Run Programs feature that bridges the gap between interactive scripting and production-ready automation. While the ToolBox editor is designed for developers and power users who write and modify AL code directly, Run Programs provides a streamlined interface for any Business Central user to execute pre-built scripts without seeing or editing the underlying source code.

With Run Programs, administrators and developers can create scripts in the ToolBox editor, save them as named programs, and then make those programs available to other users in the organization. The end users simply open the Run Programs page, select a program from the list, and click Run. The script executes against the live Business Central environment, and the console output is displayed directly on the page.

This chapter provides an overview of how Run Programs works, who it is for, and how it fits into your broader ToolBox workflow.


What Is Run Programs?

Run Programs is a dedicated page in Erik's ToolBox -- the Run Programs page -- that presents a curated list of saved ToolBox programs to users who need to execute them. Each program in the list is a self-contained AL script that was previously written and saved using the ToolBox editor.

The key distinction is the audience. The ToolBox editor is a development environment where you write, test, and refine AL code interactively. Run Programs is an execution environment where you pick a program and run it. There is no code editor visible, no syntax highlighting to worry about, and no need to understand AL syntax. The user experience is closer to selecting a report and clicking a button than it is to writing code.

Programs are stored in the Program table, which holds the script source code (in the CodeBlob field), metadata such as the program name and description, sharing settings, and optional Excel attachments. When you run a program from the Run Programs page, the ToolBox engine reads the CodeBlob, passes it through the standard Lexer-Parser-Interpreter pipeline, and executes it in the current Business Central session.


Who Should Use Run Programs?

Run Programs serves two distinct groups of users within your organization:

Program Creators (Administrators and Developers)

If you are an administrator, consultant, or developer, you create the programs that other users will run. Your workflow involves:

  1. Writing the AL script in the ToolBox editor.
  2. Testing and refining the script until it works correctly.
  3. Saving the script as a named program.
  4. Configuring sharing settings so the appropriate users can see and execute it.

You are responsible for ensuring that the programs you create are safe, well-tested, and produce clear output that the end user can understand.

Program Runners (End Users)

If you are a business user, department lead, or operations staff member, you use Run Programs to execute scripts that someone else has prepared for you. Your workflow is straightforward:

  1. Open the Run Programs page in Business Central.
  2. Browse or search the list of available programs.
  3. Select the program you want to run.
  4. Click Run and review the console output.

You do not need any programming knowledge. The programs are designed to handle the complexity internally and present you with clear results.


The Run Programs Page

The Run Programs page is the central interface for executing saved programs. When you open it, you see a list of programs that are available to you based on your permissions and the sharing settings configured by the program creator.

The page provides several actions that you can use depending on the program and your needs:

Run

The primary action. When you select a program and click Run, the ToolBox engine executes the script and displays the console output on the page. You can see the results of message() calls, timing information, and any error messages that occur during execution.

Excel

Some programs are designed to work with Excel data. If a program has the WithExcelSheet property enabled, it has an associated Excel file stored in the ExcelSheet blob field. The Excel action allows you to interact with this Excel data -- either providing input data that the program will process, or retrieving output data that the program has generated.

Add to Job Queue

For programs that you want to run on a schedule rather than manually, the Add to Job Queue action creates a Business Central Job Queue Entry for the selected program. This allows you to configure the program to run automatically at specified times -- for example, every night at midnight, every Monday morning, or every hour during business hours. See the Job Queue chapter for full details.

Download Result

After a program has executed, you may want to retrieve the output for further use. The Download Result action lets you download the results of the most recent execution, which is particularly useful for programs that generate data files, Excel output, or structured reports.


Console Output

When a program runs, its output is captured and displayed directly on the Run Programs page. This works the same way as the console output in the interactive ToolBox editor: all message() calls are redirected to the console pane rather than appearing as modal dialog boxes.

The console display includes:

  • All text output from message() calls within the script.
  • Start and end timestamps so you can see when the execution began and how long it took.
  • Error messages if the script encounters a problem during execution.

This console output is the primary way that programs communicate their results to the user. Well-designed programs use message() to report progress, summarize what was accomplished, and flag any issues that require attention.


Program Storage and Properties

Every program available in Run Programs is stored as a record in the Program table. Each record contains several important fields that control how the program behaves and who can access it:

CodeBlob

The CodeBlob field contains the actual AL source code of the program. This is the script that gets executed when you click Run. The code is stored as a blob, which means it can hold scripts of any size.

Shared

The Shared field is a boolean that determines whether the program is visible to other users. When Shared is enabled, the program appears in the Run Programs list for users who have the appropriate permissions. When Shared is disabled, only the creator can see and run the program.

Default

The Default field is a boolean that marks a program as the default. The default program is the one that loads automatically when the ToolBox editor opens. This is useful for setting up a standard starting script that you or your users work with most frequently.

WithExcelSheet and ExcelSheet

The WithExcelSheet field indicates whether the program has an associated Excel file. When enabled, the ExcelSheet blob field contains the Excel data. Programs can read from and write to this Excel data during execution using the ToolBox's built-in Excel functions such as exget and exset.

Public Sharing Permissions (Fields 300-302)

Fields 300 through 302 control the public sharing permissions for the program. These fields provide granular control over how the program is shared with other users, allowing you to define who can see the program, who can execute it, and what level of access they have.


Permission Model

Access to the Run Programs feature is governed by a straightforward permission model. To use Run Programs, a user must either:

  • Have the SUPER role assigned in Business Central, or
  • Have the dedicated Run Programs permission set assigned to their user account.

The SUPER role provides unrestricted access to all ToolBox features, including Run Programs. The Run Programs permission set provides targeted access specifically for users who need to execute programs but do not require the full ToolBox development environment.

If you are an administrator setting up Run Programs for your team, you should assign the Run Programs permission set to each user who needs access. This follows the principle of least privilege -- users get exactly the access they need and nothing more.


The Programs Page

In addition to the Run Programs execution page, Erik's ToolBox provides a Programs page for browsing and managing all saved programs. The Programs gives you a comprehensive view of every program in the system, including programs that are not shared with other users.

From the Programs, you can:

  • View all programs with their names, descriptions, and sharing status.
  • Open a program in the ToolBox editor for modification.
  • Change sharing settings to make programs available to or hidden from other users.
  • Delete programs that are no longer needed.
  • Review which programs are marked as Default.

The Programs is primarily a management tool for administrators and developers. End users who only need to run programs typically use the Run Programs page instead.


ToolBox Editor vs. Run Programs

It is important to understand the distinction between these two interfaces, as they serve fundamentally different purposes:

Aspect ToolBox Editor Run Programs
Audience Developers, administrators, consultants Business users, department leads, operations staff
Purpose Write, test, and refine AL scripts Execute pre-built scripts
Code visibility Full source code visible and editable No code visible to the user
Skill required AL programming knowledge No programming knowledge
Interaction model Interactive REPL with iterative refinement Select and run with console output
Typical workflow Write code, run, review output, modify, repeat Pick a program, click Run, review results
Excel support Built-in Excel functions available in code Excel data accessible via the Excel action
Scheduling Not directly available (manual execution) Add to Job Queue for scheduled execution

Think of the ToolBox editor as the workshop where programs are built, and Run Programs as the storefront where those programs are made available to the people who need them.


Common Use Cases

Run Programs supports a wide range of practical scenarios in day-to-day Business Central operations:

Automated Reports

You can create programs that query Business Central data, calculate summaries, and output formatted reports to the console or to Excel. End users run these report programs on demand without needing to understand the underlying data queries.

Data Maintenance Tasks

Programs that clean up orphaned records, update status fields, recalculate totals, or archive old data can be saved and made available to authorized users. These tasks are executed consistently every time, reducing the risk of manual errors.

Recurring Operations

For tasks that need to happen regularly -- such as end-of-day processing, weekly reconciliation, or monthly data exports -- you can create programs and either let users run them manually or schedule them through the Job Queue.

Self-Service Tools

Instead of fielding repetitive requests from business users, you can create self-service programs that let users perform common tasks themselves. For example, a program that resets a specific configuration, generates a standard data extract, or performs a routine validation check.


Getting Started

To begin using Run Programs:

  1. If you are a program creator, start by writing and testing your script in the ToolBox editor. Once it works correctly, save it as a named program and configure the sharing settings. See Creating Programs for detailed instructions.
  2. If you are a program runner, open the Run Programs page in Business Central (search for "Run Programs" or navigate to it from the ToolBox area). Browse the available programs, select one, and click Run.
  3. If you need programs to run on a schedule, see Job Queue for instructions on setting up automated execution.

Ensure that you have the appropriate permissions before attempting to use Run Programs. Contact your system administrator if you cannot access the page or if no programs appear in the list.