Late fee custom script in Zoho Books

Late fee custom script in Zoho Books

Hi

New to Zoho and trying to set everything up. I want to add a late fee on my invoices. I found this script:

https://www.accountexnetwork.com/blog/2016/08/zoho-books-continues-automate-custom-functions/

//create a variable to get invoice total and add a 5% discount
latefee = invoice.get("total").toDecimal() * 0.05; 
//display the value stored in the latefee variable
info latefee ;
//add late fee and adjustment and store the total amount in the variable 'adjustment'  
adjustment = invoice.get("adjustment").toDecimal()+ latefee; 
jsonstring = "{\"adjustment\":" + adjustment + ",\"reason\":\" late fee\"}";
// To update the current record
result = Map();
result = zoho.books.updateRecord("Invoices", organization.get("organization_id"), invoice.get("invoice_id"), jsonstring.toMap());
info result; 


But when i run the script i get an error: Source does not exist.

I have no scripting skills and i am actually surprised that a function like adding a late payment fee is not standard option or included in Zoho Books.
Any help to get this working is much appreciated.

Kind regards

Kevin