ToolBox
Allow regular users to run ToolBox programs
You can grant regular users limited access to run selected programs, making it easier to delegate certain tasks without compromising system security.
Setting Up Programs
- Open the Interactive Code page in ToolBox (Administrators can navigate to the ToolBox -> Interactive Code page).
- Write your AL code in the provided editor. For example:
var
Customer: Record Customer;
begin
if Customer.FindSet() then
repeat
Message(Customer.Name);
until Customer.Next() = 0;
end; - Run the program. ToolBox compiles and executes it instantly, displaying any
Message()
outputs or errors. - Save the program with a meaningful name:
- Provide a title (e.g.,
Customer List
) - Optionally include version notes or descriptions.
- Provide a title (e.g.,
Why Use Programs?
- Rapid prototyping or testing of AL logic.
- Quick custom reports or data processing tasks without needing a full extension lifecycle.
- Handy automation scripts you can share with colleagues.
Making Programs Publicly Available
By default, only super users can see and run programs in ToolBox. If you want other (regular) users to run a particular program:
- Go to ToolBox -> Interactive Code
- Select the program you want to share (from the Load list).
- Enable “Available for Public Usage”.
- (Optional) Assign a permission set if only users with a particular permission set should run this program.
- For example, you might require the “Sales Clerk” permission set to run a particular invoicing script.
Once marked “Available for Public Usage,” the program will appear in the Run Programs list for qualifying users.
Allowing Regular Users to Run Programs
When a regular user (non-super) opens ToolBox:
- They will see a simplified menu, with only Run Programs available (or other limited options, depending on their permissions).
- Under Run Programs, they can see any programs marked “Available for Public Usage.”
- By selecting a program and clicking Run, the program executes. Any
Message()
outputs or results will display to them in the ToolBox interface.
Tip: As the administrator, you can configure each user’s privileges within ToolBox under ToolBox -> Setup -> Users. For instance:
- God Mode: Full access to create, edit, delete, and run programs.
- Normal: Run programs and optionally edit data in permitted tables.
- Read-Only: Only read data; cannot modify records.
Integrating with the Job Queue
You can schedule programs to run automatically and repeatedly, just like any typical AL codeunit:
- Open ToolBox -> Run Programs.
- Select the program you want to schedule, then choose Add to Job Queue.
- In the Job Queue setup window, configure:
- Recurrence (e.g., daily, weekly).
- Start time and Days of the week.
- When the job queue entry runs, any output that would normally appear in the ToolBox output window will be logged in the Job Queue Log, including
Message()
outputs.
This allows for hands-off automation of tasks such as data cleanup, report generation, or other repetitive work.
Using Excel Integration as a Simple UI
ToolBox provides an embedded Excel workbook that you can manipulate from AL code to simulate a simple request page or user input form:
Writing Data to Excel
Use exset(Row, Column, Text)
to place text or data in a specific cell:
exset(3, 4, 'Hello');
Reading Data from Excel
Use exget(Row, Column)
to read text or data from a cell:
message('Cell content: %1', exget(3,4));
Opening the Excel Sheet for User Input
You can create a script that prompts the user to fill in certain cells and then proceeds:
// Example using Excel as a request form
exopen('Enter date range');
message('From %1 to %2',exget('B1'),exget('B2'));
When the user runs the program:
- ToolBox opens an Excel sheet with relevant cells pre-labeled.
- The user enters data (e.g., start date, end date) in the specified cells.
- On closing Excel, the script reads those values and proceeds accordingly.
Saving the Excel Configuration
When you save your program, you can also save the current Excel sheet layout. This means when the program is loaded again, it restores your custom cells, labels, and any default values.
Best Practices
- Restrict sensitive scripts to administrators or super users; mark only safe, tested scripts as publicly available.
- Use permission sets to fine-tune who can run which scripts.
- Document your scripts within ToolBox so other team members understand their purpose.
- Limit direct table writes when assigning programs to regular users; consider read-only or limited table access to protect data integrity.
- Regularly review publicly available scripts to ensure they remain relevant, secure, and correctly permissioned.