Custom script stops form fields from updating

I added a custom client script to the Sales Invoice form to update a custom field with the customer’s current balance. The script works perfectly - except, with the script enabled, no other processing/scripts on the form work. I noticed because with the script ON, the form no longer populates the Price List field based on the customer group default - it just defaults in whatever’s in Selling Settings, instead of using the customer/customer group logic. BUT, If I turn the custom script OFF, the Price List field updates like it should when I create a new Sales Invoice. So the custom script is stopping the form from doing what it’s supposed to do on load. Any ideas on why, or how to fix it? Thanks!

My script:

frappe.ui.form.on('Sales Invoice', {
	refresh(frm) {
		cur_frm.cscript.customer = function(doc) {
		        method: "erpnext.accounts.utils.get_balance_on",
		        args: {date: doc.posting_date, party_type: 'Customer', party: doc.customer},
		        callback: function(r) {
			        // doc.previous_balance = format_currency(r.message, erpnext.get_currency(;
			        // refresh_field('previous_balance', 'accounts');
			        doc.previous_balance = r.message;
			        refresh_field('previous_balance', 'accounts');