Access via: Account Settings › Design Customisation › Advanced CSS & HTML Customisation › Custom Scripts (left-hand list)
Prefer a video walkthrough? Watch our Customise QuickFile with CSS, HTML and scripts tutorial on the QuickFile Help Guides YouTube channel.
Global Scripts (called Custom Scripts in the editor) runs your own JavaScript on every page of your QuickFile admin area. Use it to automate small tasks, such as ticking a box you always tick or clearing a field you always change.
Admin area only: scripts don’t run in the client area, so your clients never see them.
$ straight away.<body> has a class that names it, so you can run code on one page only:| Page | Body class |
|---|---|
| Dashboard | .page-dashboard-index |
| Sales invoice view / send | .page-sales-preview |
| New purchase | .page-purchases-create |
| Bank statement | .page-bank-statement |
To find the class for any other page, press F12 and look at the <body> tag.
Wrap each snippet like this. It only runs on the page it’s meant for, and an error won’t affect other pages:
$(function () {
try {
if ($("body").hasClass("page-sales-preview")) {
// your code for the invoice view / send page
}
} catch (e) {
console.warn("Custom script error:", e);
}
});
When you open the send panel on an invoice, this ticks CC me and Add due date to my calendar for you:
$(function () {
if (!$("body").hasClass("page-sales-preview")) return;
$("#chkCcMe").prop("checked", true).trigger("change");
$(".chkcal_reminder").prop("checked", true).trigger("change");
});
Clears the receipt date and due date on a new purchase, so you can’t save today’s date by mistake:
$(function () {
if (!$("body").hasClass("page-purchases-create")) return;
// Don't clear dates when an existing purchase is opened for editing
if (/ID=/i.test(location.search)) return;
$("#tblstaticInvoiceSettings #txtreceiptDate").val("");
$("#tblstaticInvoiceSettings #txtdueDate").val("");
});
Test this on your own account first: make sure dates are still there when you edit an existing purchase.
console.log output.New to Advanced Customisation? Start with Advanced Customisation Tools for an overview of every template, plus troubleshooting tips.