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


    Access your files securely from anywhere







                            Zoho Developer Community




                                                  • Desk Community Learning Series


                                                  • Digest


                                                  • Functions


                                                  • Meetups


                                                  • Kbase


                                                  • Resources


                                                  • Glossary


                                                  • Desk Marketplace


                                                  • MVP Corner


                                                  • Word of the Day


                                                  • Ask the Experts





                                                            Manage your brands on social media



                                                                  Zoho TeamInbox Resources



                                                                      Zoho CRM Plus Resources

                                                                        Zoho Books Resources


                                                                          Zoho Subscriptions Resources

                                                                            Zoho Projects Resources


                                                                              Zoho Sprints Resources


                                                                                Qntrl Resources


                                                                                  Zoho Creator Resources



                                                                                      Zoho CRM Resources

                                                                                      • CRM Community Learning Series

                                                                                        CRM Community Learning Series


                                                                                      • Kaizen

                                                                                        Kaizen

                                                                                      • Functions

                                                                                        Functions

                                                                                      • Meetups

                                                                                        Meetups

                                                                                      • Kbase

                                                                                        Kbase

                                                                                      • Resources

                                                                                        Resources

                                                                                      • Digest

                                                                                        Digest

                                                                                      • CRM Marketplace

                                                                                        CRM Marketplace

                                                                                      • MVP Corner

                                                                                        MVP Corner









                                                                                          Design. Discuss. Deliver.

                                                                                          Create visually engaging stories with Zoho Show.

                                                                                          Get Started Now


                                                                                            Zoho Show Resources

                                                                                              Zoho Writer

                                                                                              Get Started. Write Away!

                                                                                              Writer is a powerful online word processor, designed for collaborative work.

                                                                                                Zoho CRM コンテンツ



                                                                                                  Nederlandse Hulpbronnen


                                                                                                      ご検討中の方