Access via: Account Settings › Design Customisation › Advanced CSS & HTML Customisation › Custom Scripts (left-hand list)

Prefer to watch?

Watch Customise QuickFile with CSS, HTML and scripts on YouTube

Prefer a video walkthrough? Watch our Customise QuickFile with CSS, HTML and scripts tutorial on the QuickFile Help Guides YouTube channel.

Introduction

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.

What’s available

  • Plain JavaScript and jQuery 2.0, which is already loaded, so you can use $ straight away.
  • Your script runs after the page has loaded.
  • Each page’s <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.

The safe pattern

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);
    }
});

Recipe 1: Pre-tick options when sending an invoice

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");
});

Recipe 2: Choose purchase dates yourself

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.

Good practice

  • Undo quickly: if a script breaks a page, deactivate Custom Scripts.
  • Debug: press F12 and open Console to see errors and your console.log output.
  • Only use scripts you understand. They run with full access to your account.
  • Share useful scripts on the QuickFile community forum.

Related topics

New to Advanced Customisation? Start with Advanced Customisation Tools for an overview of every template, plus troubleshooting tips.