SalesPad Scripting is a no-code custom rule automation engine inside Business Central. Each script is built with predefined steps in a drag-and-drop designer that can find records, check conditions, update fields, trigger BC’s custom AL codeunits, and more. Scripts can run on demand, on a schedule, and automatically when records are saved. Instead of paying for AL code development every time you add or change a business rule, power users create scripts themselves.
Table of Contents
What can scripts do?
Scripts add custom validation and automation to enforce your business rules and eliminate manual steps. They check fields, show popups, ask questions, update records, prevent saving bad data, generate reports, run custom processing on a schedule, and trigger BC’s AL codeunits.
Examples include:
-
When an order is created, fill in the customer’s default vendor and payment terms
-
Prevent saving orders if any lines are below a minimum margin threshold
-
Prevent saving items without a default vendor
-
Show a popup warning if the customer’s balance is past their limit
-
Ask “Apply the holiday discount?” on a quote and update lines only if the sales rep says Yes
-
Combine multiple quotes for the same customer into the same order for fulfillment
-
Nightly, find customers over their balance limit and flag them for review
-
Weekly, email a quick report to target buying groups with the latest inventory information
-
Trigger Power Automate to run integration automations during order entry
What can scripts do with data?
Scripts can find any records in BC (including custom tables and extensions), loop through records, and set fields based on conditions or calculations. They can calculate values and keep track of running totals in variables, and they can create, update, and delete records. Scripts can also call BC’s custom AL codeunits to trigger more complex logic.
Can scripts interact with users?
Yes, scripts can show popup messages, error messages, and notification banners at the top of the page. They can also ask the user to select Yes or No in a popup, and then trigger different actions based on their choice. When a script runs in the background, popups are skipped and those messages are logged instead.
Can scripts send emails?
Not directly; there is no built-in “send email” step. Quick report scripts can send emails which will include a quick report as an attachment (Excel or CSV). If an email needs to be sent without an attached report, then a partner can create the emailing code in a small codeunit, and the script can call that with the Run Codeunit step.
Can scripts call outside web services?
Not directly; there is no built-in “call URL” step. A partner can create a small codeunit to call the outside web service, and the script can trigger that with the Run Codeunit step. The script makes it possible to trigger this logic during typical order entry and workflow processes. The script decides when, and the codeunit handles how.
Can scripts post documents?
Scripts can call any codeunit, including posting routines. Posting is a high-impact action, so Cavallo recommends a partner sets this up and that this is tested thoroughly in a sandbox environment before using it in production.
Do scripts work for the mobile app?
Yes, scripts run on the BC server, so on-save scripts fire however the record is saved: web client, mobile app, API, or another extension’s code. The SalesPad Scripts menu, with its Run Script and Quick Report actions, appears wherever the BC page does.
What types of scripts are available?
Scripts can run when sales documents are saved, when they travel a specific path in Mission Control workflow, when someone clicks the Run Script action button or runs a quick report, and automatically on a set schedule. Scripts can be triggered for a variety of record types including sales documents, customers, and items, and they can be extended to run for any BC record type.
What are on-save scripts?
On-save scripts trigger automatically when a record is saved. There are two types of on-save scripts: one that triggers when new records are created, and one that triggers when an existing record is changed. This provides flexibility in defining requirements and actions that take place for creation vs updates.
What are run scripts?
Run scripts can be triggered manually on BC cards, and they can be hooked up to Mission Control workflow to run when documents move through process steps. They can also trigger automatically on a set schedule, and they can be exposed for third-party applications to run the script logic based on their rules.
What are quick report scripts?
Quick report scripts generate basic grid reports which can open on-screen for immediate visibility or be emailed as an Excel or CSV attachment. These reports can be run manually on BC cards or the SalesPad Quick Reports page, or they can be sent automatically on a schedule.
Which records can use scripts?
Scripts are available on pages for documents and line items tied to sales, service, purchasing, warehouse shipments, and transfers, as well as records like customers, vendors, items, general journal lines, and item ledger entries. SalesPad Scripting also supports extensibility for records and pages outside this list, which requires a small code extension to be created.
For more information on supported record types, refer to the technical documentation.
How do I get started with SalesPad Scripting?
Install the SalesPad Scripting extension from the BC marketplace and you can test in a sandbox environment right away. Contact Cavallo to set up your license, and then you can activate scripts in your production environment to enforce your business rules and automate manual work.
Check out the technical documentation for information on how to install SalesPad Scripting, manage script access, and create scripts with the Script Designer and the Copilot assistant.